Search code examples
iphonexcodecordovameteorbraintree

Meteor xcode project created with 'meteor build' vs. project created with 'meteor run ios-device'


I have a specific question about any differences in the build process for a Meteor (IOS) xcode project when you run the following two commands:

meteor run ios-device --mobile-server 10.0.1.16:3000 --settings settings.json

vs.

meteor build /mobile-build --server 10.0.1.16:3000 --mobile-settings settings.json

Both create an xcode project, which I can then run on my iphone, however the project created using the build command does not behave the same as the project created using the 'run' command.

I basically have a test project, which I'm trying to get the braintree drop-in UI to work within a meteor/cordova page. This takes a named container (drop-in) and injects controls via a braintree.js script in order to get around hosting sensitive payment information on your own server.

I'm at the point where it works fine on my physical iphone device when using the 'meteor run' command (this launches xcode and I choose the destination + click play), however actually creating a build (command #2 above) and then running exactly the same code the portion of the page that shows the injected controls doesn't load anything. Both xcode projects/code work fine in the IOS Simulators, so it is just on the physical iphone device that I'm having issues.

I originally thought this may be to do with access rules, however the fact that the same code works fine when using 'meteor run' makes me think there is a difference in how the project is being compiled into xcode when running the build command.

I've checked the console in xcode when running the 'non working' xcode project on both the simulator and physical phone but the output is identical. All other content except the injected HTML is displaying fine, its literally just the controls that are not appearing.

Any pointers would be much appreciated.

David


Solution

  • You're likely suffering from an issue arising from the concatenation of javascript files.

    The only difference between 1) and 2) is files in 2) are built in production mode and are minified and concatenated.

    You likely have an error in your code somewhere, which appears on both apps 1) and 2).

    The issue is when the app is concatenated the error is likely to halt the execution of further code. Take the below

    var x={}; x.run(); alert("GO");
    

    The alert will never fire due to the error mid-way.

    Unfortunately, there's not much I can do to pinpoint where your error is coming from. You would have to use a remote inspector such as the one on Safari to identify where it comes from.