Push doesn't work (Error: Could not get) - ios

Trying to use Ratchet's push.js, but doesn't work.
What I have in console:
[Error] Error: Could not get: file:///var/mobile/Applications/337585D8-89E1-4810-AB37-0A6DD2DA3A34/Gustav.app/www/booking.html
failure (ratchet.js, line 446)
onreadystatechange (ratchet.js, line 371)
If you will tap link like ten times you start to receive this:
[Error] TypeError: 'undefined' is not an object (evaluating 'cacheMapping[PUSH.id].url')
cachePush (ratchet.js, line 202)
PUSH (ratchet.js, line 392)
touchend (ratchet.js, line 258)
All this console data from real device tests (iOS 7.1), wrapper is Cordova CLI 3.4.1-0.1.0.
File booking.html exist, native safari failure like this
[Error] Failed to load resource: The requested URL was not found on this server. (menu.html, line 0)
doesn't appear.

push.js does not support file:// protocol.
Ratchet uses XHR requests to fetch additional pages inside the
application. Due to security concerns, modern browsers prevent XHR
requests when opening files locally (aka using the file:// protocol);
consequently, Ratchet does not work when opened directly as a file. A
common solution to this is to simply serve the files from a local
server. One convenient way to achieve this is to run python -m
SimpleHTTPServer to serve up the files in the current directory
to http://localhost:<port>
Also see this issue and this issue submitted on Github
It seems like this is a common issue with using Cordova and Ratchet.

Related

Cross site issue with Microsoft Graph Toolkit

I'm following this tutorial to create a simple web app with a Microsoft 365 login. I'm currently getting this error when debugging locally (http://localhost:8080):
Warning:
mgt-loader.js:61 A parser-blocking, cross site (i.e. different eTLD+1) script, https://unpkg.com/#microsoft/mgt/dist/bundle/wc/webcomponents-loader.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
In Azure, I have the Redirect URIs set up to match (http://localhost:8080).
After some googling, I tried adding async, but then I get this warning and the login button doesn't appear:
mgt-loader.js:61 Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
What would be causing this warning and how can I fix it?
First, check out how document.write works: https://developer.mozilla.org/en-US/docs/Web/API/Document/write
You will understand why you cannot run document.write in asynchronous context (try running document.write('Hello world!'); in console on any page).
Warning tells you that a parser blocking (synchronous), cross site (not coming from the same domain as website) scripts can be blocked by Chrome in the future if someone has unstable or bad internet connection.
If you want it to run synchronously without that warning, you have to bundle that JS code with your own, or just serve it from your own origin, same as your website (e.g. localhost:8080). You can download #microsoft/mgt npm package and for bundling - use gulp, webpack or other tool of your choice.
https://unpkg.com/#microsoft/mgt#2.4.0/dist/bundle/wc/webcomponents-loader.js
This script tries to differentiate between async and sync contexts (line 175) and run document.appendChild (instead of write) for async context - but for some reason the check fails (readyState === loading).
https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
How to check if an Javascript script has been loaded Asynchronously (Async) or async attribute is present?
If you want to run this in non-blocking manner, you could try to fix the script by yourself.
There is a Github repo for that toolkit (https://www.npmjs.com/package/#microsoft/mgt), but there is no issue regarding async loading, nor regarding the warning that you have noticed - so maybe nobody else has noticed or thought about it yet.

How do I get polyfills to work with Relay?

I have a PHP app and I'm trying to use it with GraphQL and Relay, but trying to get Relay working I keep getting this error in my Browser (Chrome and Safari)
warning.js:36 Warning: Relay relies on polyfills for ES6 features in older browsers. Babel provides a good one: https://babeljs.io/docs/usage/polyfill/
I've tried all sorts of things, and I can't seem to get it to work.
Change webpack configuration, include the polyfill.js as a script.
I can't ignore that warning, because later on I will get:
RelayTaskQueue.js:97 Uncaught TypeError: _promise2.default is not a constructor
I managed to fix the problem myself. The problem was that I was running on Mac OS X with a case insensitive file system.
I tried creating a disk image with case sensitivity, and it worked. Followed instructions here. https://gist.github.com/dixson3/8360571 #

Angular 2 app not loading with Cordova on iOS

I am facing serious problems while developing an Angular 2 app and building it for iOS with Cordova. It kind of works when building and running it for Android (still there are some problems with routes on startup), but I can not get it running on iOS.
The app is developed with Angular 2.0.0-rc.1 and angular-cli.
Whenever I build the app with xcode for iOS, the app is stucked on Angular 2 loading - i guess it is a problem with the bootstrapping process, but I am not sure.
In console, I can see that it fails to load the component css files, like this error shows:
[Error] EXCEPTION: Failed to load file:///var/mobile/Containers/Bundle/Application/F325C057-2287-463A-ABF6-DB68944C63D9/Dooda.app/www/app/notifications/notifications.component.css
logError
logGroup
call
(anonyme Funktion)
invoke (zone.js:323)
onInvoke
invoke (zone.js:322)
run (zone.js:216)
(anonyme Funktion) (zone.js:571)
invokeTask (zone.js:356)
onInvokeTask
invokeTask (zone.js:355)
runTask (zone.js:256)
drainMicroTaskQueue (zone.js:474)
invoke (zone.js:426)
The path is correct, it just can not proceed to load the files. In my iindex.html, I can see that the Container is empty, thus the Angular 2 stuff is not loaded there.
I have set the base href in index as following:
<base href=".">
If you need further information or code, please ask.
Have anyone faced the same issue and can help me here? I am really clueless what to do now, I have no idea why the file loading fails here.
Any help would be highly appreciated!
Thanks in advance!
The solution is very simple, just use
<base href="./">
in index.html file. It will work
had the same problem with Cordova / Ionic on iOS. It was caused by an empty file.
I had a component without template markup, but only with SCSS for the :host-selector.
It seems like Safari doesn't recognize any empty files via XHR and encounters a 404-like error, which breaks the application. To fix that, I removed all empty files from my components. After that it did work for me on iOS-emulator and native iPhone 6.
I am not sure whether it is related with base url for you problem.
In the normal, we will build and package the app with angular-cli into www dir. And after that, you should not see separate css files anymore. Because all css files will be packed in one file, based on your webpack setting.

Error generating links on branch io

I am generating dynamic links from the application using Branch IO. It generates link properly but sometime theres error generating link like
The request timed out.
CFNetwork handshake failed
Is this issue from branch side?
Found error in my network. Due to firewall issue, some of the packets were dropped.
Tried from other network i was able to get rid of the above issue.

Marmalade error download

i tried everything to solve this but since two days i'm blocked.
i need IwNui Api in my application to build interface for my application iOs, but when adding this package to the mkb project with this line 'subproject IwNUI', Visual studio block on this trace error :
Building project: c:/Users/PC/Documents/testaaaa/testaaaa.mkb
1>c:/Users/PC/Documents/testaaaa/testaaaa.mkb(14): warning : filename case does not match the filesystem: c:/marmalade/6.2/modules/IwNUI/IwNUI.mkf
1> Executing: 'c:\marmalade\6.2\s3e\bin\mdev.bat update'
1> Downloading: http://source.madewithmarmalade.com/packages/6.2/Packages
1> Downloading: https://raw.github.com/marmalade/mdev-package-list/master/6.2?1365852339.42
1>CUSTOMBUILD : error : error downloading url: https://raw.github.com/marmalade/mdev-package-list/master/6.2?1365852339.42 (<urlopen error (8, 'EOF occurred in violation of protocol')>)
1>c:/marmalade/6.2/modules/iwutil/iwutil.mkf(19): error : Executing 'c:\marmalade\6.2\s3e\bin\mdev.bat update' failed. (return code 1)
1> FAILED (error code=3)
Even every examples of marmalde launchap which use Iw** api can't be build because the dowload of : https://raw.github.com/marmalade/mdev-package-list/master/6.2?1365852339.42 is not working.
I saw tips on some pages but these not fixed it for me (delete folder in roaming/appdata/marmalade , close firewall, try with old sdk 6.2.1,6.2.0,6.1 etc)
I'm open to every suggestions, my development was going well until i need an UI to going forward. I'm beginner in interface development and if a different and easy way exist for adding a Ios UI i'm also interested in.
Thanks a lot for reading, dams
Marmalade needs the mdev package to function properly, thus you've to download it anyways, there're now way you can skip it. The problem is with your internet connection. Probably it's not accepting HTTPS connections. Try using some other internet provider or check using some friends' wifi. I always get this error when my internet is slow and the download gets timeout. Changing the internet plan is the only thing that might help.
In case it gives the same error on other internet connection, then it might be some issues with how you set up marmalade, Try reinstalling it.

Resources