Modules in IOS with Air app - ios

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.

Related

Is it possible to run code from a downloaded framework in 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.

Can I package entire iOS app as a Framework?

I have an app implemented in native iOS (Swift). There is a web version of the app as well. A client wants to embed my app to its own app and suggested I use an iFrame and load the web version.
I understand this is a tricky solution as Apple might reject the app for not using native implementation.
What I want to ask is if there is a way to package my app entirely as a Framework and load it that way (app size is fairly big, with several viewControllers and functionality).
I understand that I won't have access to App-load functions like the AppDelegate.
Also what happens if my app has Library dependencies ? (such as Alamofire)
Any other things I should be concerned about ?
Thank you
There are obviously a lot of options around this as far as design/approach.
I've done this multiple times (with apps live on the app store) and really it's just like developing any Framework.
First: AppDelegate. The easy way around this is to have the app's AppDelegate subclass your Framework's AppDelegate:
#UIApplicationMain class ParentAppDelegate: FrameworkAppDelegate { }
Just make sure the App calls super on all the relevant methods.
Second: Dependencies. This is probably the most annoying part since Frameworks can't embed other frameworks. But you still have a few easy options:
Have the enclosing app embed the needed framework
Add the sources of the needed framework directly to your framework.
Use a dependency manager (e.g. cocoapods) that takes care of this for you.
Other Concerns: One trap you can easily run into is working with Bundles. Anytime you dynamically load images/strings/IB references/etc. you will need to specify you're using the Framework's bundle, as at times it can default to using the app's bundle. The easiest way to do this is with this init e.g. Bundle(for: self.self)
Also keep in mind that the settings in info.plist and entitlements your framework needs will need to be added by the parent app.
General Comments on Approach: My advice (take it or leave it ☺️) would be caution around simply adding your full application to a client's application. Aside from IP and App-Review concerns, it can result in adding a lot of complexity or a fork of your current application to support it, making future maintenance a hassle.
Instead I would recommend putting only the portions of the application your client requires into a separate framework that both you and your client use for your separate applications.

How to manage dependencies' conflicts between a framework that I'm making and the main app?

I'm making a framework (an SDK) that will be made public. I'm thinking about a situation when it's not distributed via Cocoapods / Carthage, but rather via a simple Downloads page.
In the SDK I need to provide users an opportunity to login and share via Facebook, so I would like to use appropriate Facebook SDKs (FBSDKLoginKit / ShareKit, I assume). But if the end user of my SDK will also have these Facebook SDKs (or any other duplicate dependency), there will be a conflict.
What is the proper way to handle this situation without using Cocoapods / Carthage? I believe, one way is to avoid including / statically linking dependencies into my framework, but rather have end users download dependencies separately, but maybe there is another way around it? Making people download tons of libs from different sources isn't very convenient.
The question isn't about Facebook SDKs in particular, but about a general situation with third-party dependencies when developing a framework / library.
P.S. I found this question: Integrate Facebook SDK inside my iOS Framework. But it's specifically about Facebook, and it might be outdated (a lot of stuff happened in the iOS world since 2014).
UPDATE: the SDK will be closed source.
You could do a combination of the two ideas you suggested:
Don't include the other SDKs directly in your framework, but have them in the same project when the user downloads it. That way, if the user doesn't already have them, they can copy over all of the frameworks that they need. And if the user does already have them, then they can just copy your SDK by itself and have it just work in their project.
This combination also allows you to include tests and samples in the download. Then users end up downloading a complete, functioning project that they can try out before integrating it with their own code.

Different apps from the same code base

I have developed a generic app, which can ne customized for clients. Each app should be available in the app store.
Any idea what is the best way to deploy the different apps? This is of course also necessary on app updates.
Only the package name, some graphics and some settings change for different Apps. The Code will be the same for all.
Consider deploying your app as a framework, static library or CocoaPod. The clients should be able to use your framework/pod to customize the appearance (and anything else) and publish their apps.
CocoaPods: If your project is in progress and your client is using it, I wouldn't recommend it. Pods are great way for managing dependencies mostly if dependencies are not going to change on nightly basis. Also you'll have to make a few decisions about how to integrate it with your source control. If you and your clients will be working on their client app and pods simultanously. They'll most likely have to get your pods in a workspace, which defeats the purpose of pods. (If somebody knows a better way around editing pods and project simultanously, please let me know as well.)
Static Library/Frameworks: Rey Wenderlich has a good tutorial for creating frameworks. http://www.raywenderlich.com/65964/create-a-framework-for-ios

Show unity 3D in xcode project

I have a question. Is it possible to load unity project from web, and show it in Xcode project? In some non-fullscreen view? Also, unity must handle touch events. Any ideas, suggestions, links or anything else?
Thanks for advice.
P.S. Sorry for my english.
P.P.S. Main project created in Xcode, without unity.
load unity project from web
What do you mean by that? If you mean a compiled unity webplayer application, forget it.
If you mean a standard non compiled Unity project, note that with the iOS plugin you can compile for mobile Apple hardware. This used to cost a lot of money but now they're giving it out for free (included in Unity free).
Also, unity must handle touch events.
The standard Input Unity class handles touch events with methods such as GetTouch() and variables like touchCount or touches.
Unity is a very big and complex package: integrating it into an existing project may be overwhelmingly difficult. I really don't think there are natives way to do so.
Rather, I'd advise you to port your current XCode project into Unity (which sounds a really strange thing to do if you ask me).
Unity and XCode are 2 completely different tools: the former is useful for Cocoa classes and iOS IDE while the latter is for managing 3d game assets in a real-time interactive environment. I don't see how you can possibly integrate the two things.
Manage your project in a single IDE, it will make things a lot simpler.

Resources