Is it possible to run code from a downloaded framework in iOS? - ios

I want to present a ViewController from a framework which is downloaded later in the app document directory (Something like Microsoft Code-Push in React Native).
Be more specific: I want to install an app (in React Native, Swift, etc) then it would download another swift(objc) compiled app and run it in the next startup.
(I don't care about the first app but It's critical to run a swift compiled code.)

As you have now learned in the comments, you cannot download and "run-on-the-fly" compiled code.
A couple thoughts though...
As you are trying to "get around Apple's review process" you should be aware that any method you use to change your app after approval can be risky.
Whether it's downloading graphics, updated data files, config files to change appearance or functionality, using Cordova or React Native (as with Code-Push), etc - minor changes are fine.
Data updates, new imagery, etc. Even layout changes handled by your internal code are no big deal.
However, making major changes, particularly when it is obviously done to get around initial rejection, will end up resulting in your account being banned if/when you get caught.

Related

How can you permanently change iOS app configuration in Meteor Cordova?

Every time I meteor build, I have to open XCode and do the following:
remove and add an item from "Link Binary With Libraries" (Facebook SDK)
add a URL Type (custom URL scheme for my app)
add a "Required device capabilities" to "Custom iOS Target Properties"
How can I edit my Meteor project to have these steps done automatically, and to auto add things to AndroidManifest.xml?
In some way use mobile-config.js or cordova-build-override?
I'm happy to see another guy who is trying to build a hybrid application using Meteor / extending a Meteor Cordova iOS app, since I'm facing the very same issues. So I'm very happy to share my experiences and approaches with you. :-)
So far, I ended up with the following approach:
I created a base template for my iOS app using meteor build (not meteor run ios-device, since I did not know if Meteor does some optimizations for production code).
Then, I copied the whole Xcode project under /platforms/ios to another loaction and used this new project as my "master" project from then on. This project is being enriched with native code, e.g. it also includes the Cocoa Pods I'm needing.
Of course, I also did not want to copy files each and every time I trigger a new Meteor build. At least, I would like to have the Staging/www folder updated, as this is happening quite frequently.
So my first (rather naive) approach was
delete the Staging/www folder in the master project
replace it with a relative link (using Xcode's linking functionality) to the Staging/www folder inside the .meteor/local/.../ios/ project
This approach did not work, since the shell script used in the Meteor Xcode project can't handle these links.
My second approach is to create a symlink on the filesystem level instead. This works as it should, and I'm able to build the project in Xcode as it should.
I could have followed the same approach for the Cordova plugins folder, but I've decided to replace the plugins manually in order to get a better control over them, even it means a bit more effort then.
Having the symlink in place also means that Xcode's version management (and also SVN which I am using for everything) will ignore everything below Staging/www, which is good in my opinion, because I'm already versioning the webapp code in the Meteor project itself.
BTW: I've started a discussion thread on hybrid mobile app on the Meteor forums as well, but so far it did not get too much attraction:
https://forums.meteor.com/t/building-a-hybrid-meteor-cordova-app-share-experiences/8212
Maybe we could follow up on Meteor-specific things there, to have the Meteor community participate in the discussion?
EDIT: I would also like to share an approach that failed completely, at least for me, maybe I was too dumb... Before I used Meteor's Xcode template as the starting point, I also tried it "the other way round", i.e. I started with my already existing Xcode app project and tried to include Meteor's / Cordova's part by hand. Using this approach, I never managed to set everything up correctly. I had lots of troubles and also had to tweak a lot of the compiler / linker flags to even get the code compiling. This grew me a lot of gray hairs. But even after I managed to get everything to compile, Meteor hang during startup - and I never figured out why.
One remaining problem I'm still facing is that Meteor's hot code push functionality seems to have some severe issues on iOS, that are also documented as GitHub issues. It can happen that the iOS app gets completely broken and needs to be reinstalled. I tried the mdg:reload-on-resume package, but this did not work as it should and made things even worse. As far as I can tell from the GitHub discussions, one should better disable hot code push until the Meteor team has addressed these issues. Breaking the app completely due to code pushes is not what my users would expect.
Unfortunately plist values (and assumably AndroidManifest.xml as well) can only be changed by a plugin:
Add entry to iOS .plist file via Cordova config.xml

Modules in IOS with Air app

We have a problem in our company with an application and would like to advise us an optimal solution, the point is that we have an application for tablets made with Flex mobile, our application can open modules in execution time downloading it from a server, these modules are opened perfectly with AIR or Android but in IOS is not possible, that's not working. Some solutions for us to have the extra functionality that provide these modules have occurred, are as follows:
1. Create a library for each extra functionality of each client and import all of them in the main application project.
2. Create a unique library with the functionality of all clients and then, import it in the main application project.
3. Create as many native extensions (ANE) and functionalities as are required by our different customer and import them into our application.
I would like to know which solution is optimal because in the future we can get 100 customers and maybe too much functionality may slow down the application.
Thank you very much.
Apple does not allow dynamic linking at runtime. Modules are executable code and need to be bundled at build time, only then they can be loaded from the bundle.
Otherwise you could circumvent the AppStore and add any, potentially harmful code at execution time.

Determining if iOS frameworks are actually needed

I am rebuilding an App and at the same time paring it down of unnecessary code and it contains "required frameworks" that I think were left over from copying a previous app shell for building this app. How can I determine if a framework is actually needed. I thought I could just leave them off and build the app and then add them as required to let it build successfully but in the past that has not worked well to my surprise as I have built and tested a previous App without any additional frameworks added and the App built and ran just fine on simulators and actually devices only to find out at submission time I forgot to add the frameworks before submitting it.
I am trying to be proactive and only put in the ones I need. Some, like the MediaPlayer are definitely not needed and I can eliminate them already but some are harder to determine.
Curious if there was an easy way to figure this out.

FlashDevelop - Loading external swfs on iOS

My application needs to load external swfs with ABC. I checked that this feature is available in AIR 3.7 and later. I managed to get the new SDK - 3.8 with the latest version of FD (4.4.3).
Now I am following this link: http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air-apps-on-ios/
According to this post, "During IPA packaging, ADT extracts the ABC code from all child SWFs, adds it to the final executable and generates stripped SWFs in the “externalStrippedSwfs” folder created in the current working directory. The directory structure within the “externalStrippedSwfs” folder remains the same as specified within the text file. The generated stripped SWF’s should then be externally hosted on a web server of developer’s choice."
However, firstly, I could not find any such folder called "externalStrippedSwfs".
Secondly, even if this works, this means that everytime I have a new external swf to load, I will have to get it stripped off the code, put it in the main swf, and then upload the stripped swf (with assets). So everytime I do this, I need to "reupload" my app to Apple.
Are these assumptions right? My app architecture will need to be modified accordingly.
Yes, your assumptions are correct: You can't load an external .swf containing AS3 and have the app execute the byte code.
If we ignore the fact that it would most likely not be approved by Apple it can't technically work. The reason is because the Adobe AIR app doesn't contain a virtual machine capable of interpreting the byte code in the .swf:
When you build your application for iOS, there is no interpreted code
and no runtime in your final binary. Your application is truly a
native iOS app.
Source: http://www.adobe.com/devnet/logged_in/abansod_iphone.html.
You can do it! :) You just need to upgrade to AIR SDK3.8+ and follow the painful process.
The only limitation is that each external swif that you will be loading at run time, must be stripped by your ADT.
But you are right: you will need to update your app everytime your external content needs to be updated.
"externalStrippedSwfs" is arbitrary (name it as you wish I believe), you have to create that folder in your bin and run the command line from there.
Looks like Apple is not ready to lose the leash yet...

Why is there no 'cake watch:ios:dev'?

I am using cordova-brunch in a project and I would really like to not have to re-run the cake build:ios:dev command each time I modify the JavaScript/CoffeScript source. Even more since I usually have to also make changes in the iOS Objective-C code for my hybrid app and I generally rebuild the App from XCode forgetting to rebuild the JS/CS part.
The behaviour is identical for Chapless Brunch and Cider Brunch, but I still don't get what prevents a cake watch:ios:dev functionality. The available cake watch:cordova:dev doesn't solve the problem.

Resources