iOS 10 compatibility

I followed the instructions to update boilerplate-generator but it didn’t seem to take effect. Even tried it with a fresh meteor project. What am I missing?

I’m able to run using meteor run ios-device with the above lines I posted.

How did you add the cordova package?
I added it manually by editing the cordova-packages file, and that caused it to not take effect. By using the meteor add command, it worked.

Hello All,

Following is reproduction of meteor demo app in which I have added boilerplate-generatior still csp didn’t seem to take effect.

Please let me know if anything missing from me?

Thanks,

For anyone using <input type='file'> in their apps for choosing/uploading photos, in iOS 10 it is now mandatory to provide a description for Camera and Photos permissions, otherwise your app will crash when user tries to pick a photo (or take one with the camera).

To fix that, you will need to add Cordova’s custom config plugin:

meteor add cordova:cordova-custom-config@2.0.3

Then in your mobile-config.js file add the following section:

App.appendToConfig(`<platform name="ios">
    <config-file platform="ios" target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
      <string>YOUR DESCRIPTION (PHOTOS PERMISSION) HERE</string>
    </config-file>
    <config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription">
      <string>YOUR DESCRIPTION (CAMERA PERMISSION) HERE</string>
    </config-file>
  </platform>`);

Also, make sure you run the latest version of Meteor and other packages.

12 Likes

@M4v3R Do you think this might be the case with https://github.com/raix/push as well?

Edit: It’s a push notification module.

In my initial tests push notifications (with raix’s plugin) worked fine on device with iOS 10. If it doesn’t for you maybe try to update all your plugins?

@M4v3R Didn’t work :confused:

OK for those running meteor 1.4 (possibly others), I’ve created a little cordova plugin that overwrites the <meta> tag. Don’t get too excited, as it doesn’t work with a meteor build command, but it does work with meteor run ios-device. So it will help while you’re developing, but you’ll need to manually change the <meta> tag when you do a meteor build.

To install it, just go:

meteor add cordova:meteor-ios10-csp-fix@0.1.0

The source repository is here , the npmjs page is here

There’s actually nothing meteor-specific about this, so it might work with ionic / cordova / telerik / phonegap etc apps that use web sockets on iOS10.

@danielbh Please make sure that Push notifications are enabled in “Capabilities” in your XCode project. For some reason its always disabled when I make a new build and I have to manually switch it on.

1 Like

@M4v3R it’s enabled.

The default CSP for Meteor is missing the gap: protocol. At least in the Cordova iOS version used by Meteor 1.2 (which I am still on), this protocol has to be included in order to make communications between JavaScript and Native possible.

<meta http-equiv="Content-Security-Policy" content="default-src * data: blob: gap: 'unsafe-inline' 'unsafe-eval' ws: wss:;">

I faced this when I wanted to try-out the Twittger Digits Cordova integration in iOS 10. gap:ready should also work and be more precise, but I haven’t tried this.

The old Cordova iOS version used in Meteor 1.2 also has a bug that causes the app to crash if it tries to check which interface orientations are supported by the app. For this, there is an undocumented feature that allows the app developer to define a JS call-back to report the supported orientations back to the Native code. But even if this callback is not defined, the app crashes on iOS 10 because this check is executed in a separate thread, which doesn’t seem to be allowed anymore. I had to patch Cordova’s CDVViewController.m. In shouldAutorotateToInterfaceOrientation, all lines but the last one have to be commented out.

Thanks for this tip! Saved me some hours of searching…

Ok I got the following message from Web Inspector: “XMLHttpRequest cannot load http://subdomain.meteorapp.com/sockjs/info?cb=zbiujoe5nl. Cross-origin redirection denied by Cross-Origin Resource Sharing policy.” Any idea?

Edit: This issue appears to be unrelated after all. I was not including ‘https://’ when using --mobile-server option

Example bad: subdomain.meteorapp.com
Example good: https://subdomain.meteorapp.com

thanks all for you help / info above

background: I seem to have most of my app working. I had added the cordova:cordova-plugin-meteor-webapp patch @martijnwalraven mentioned above and explicitly added/updated the boilerplate plugin. My app opens, I can upload images etc… however my push notification have stopped working… ie the app does not show up as being push enabled.

@M4v3R @danielbh wondering if you got raix:push to work? I have manually enabled it in XCode (I never had to do this before, from memory)… but it does not seem to be a push enabled application when it installs (Simulator or on Phone)… wondering if there’s some other tricks?

+1 for an updated guide OS10 cheat sheet

Push notifications do work for me on iOS 10 with raix:push. Aside from manually enabling it in “Capabilities” tab I didn’t have to do anything for it to work. If it doesn’t work for you I would check your code if you are initializing push notifications properly for your app.

@M4v3R thanks. Mmm… not sure what I’ve done to break it with the Meteor 1.4 update. Can I ask what version of push are you using pls?

Also any idea what version should Cordova be used with Meteor 1.4?

I see Apache Cordova native platform version 4.1.0 is starting. in the xcode log… for somereason I thought Meteor used a later version?

In my project I currently use raix:push@3.0.3-rc.4. As for Cordova, it’s set to 4.1.0.

Thanks.

Phew, I had left meteor 1.4.1.1 running in the IDE overnight, this morning I got a “no memory” message, when I rebooted it had somehow corrupted my harddrive boot sector… had to wipe my harddrive (after visit to AppleStore)… mmmm… 1.4 scares me