I read many articles about dynamic library usage including this page "Can you build dynamic library...".
As apple document said, "Frameworks for iOS. iOS developers can now create dynamic frameworks. Frameworks are a collection of code and resources to encapsulate functionality that is valuable across multiple projects. Frameworks work perfectly with extensions, sharing logic that can be used by both the main application and the bundled extensions.", see full page from here.
Taking the security issue as consideration, I got the reject reason of dynamic library before iOS8, see details from "DarkDust's answer". But, how does it "just work" in iOS8? #appstore_reviewers?
Anyway, currently I'm writing a sample demo app and try to upload it to Appstore for review, the main feature is downloading a framework from internet to client and dlopen it. Hope that really "just works"!
Besides, the deployment target is iOS7.0, not sure it could works well in it.
I didn't get a so clear understand on differences between "dynamic library" and "framework", I think they are the same and in this thread I mean "Cocoa-touch framework" which could create in Xcode 6.
Some background: I'm trying to build an iOS app which does't contain extension feature, my cocoa-touch framework is for easy expand without uploading a new version as it comes from internet....
UPDATE
I published a demo project GMDemo here, will try to upload to Appstore.
UPDATE2
I failed to dlopen my dynamic framework with invalid code signing error after many tries in iOS device. Sorry, no good news here. (Almost forgot to update this question, sorry! BTW)
App Store Review Guidelines explicitly prohibit that in 2.4.5 Apps that download code in any way or form will be rejected https://developer.apple.com/app-store/review/guidelines/
UPDATE3 just use the same code signing!!!
I have test it in ad-hoc environment!
when my dynamic library use the code signing with the same code signing,It works,
otherwise,crush!!
Related
Goal
I'm building an iOS app using flutter for frontend, and C/C++ as backend. They must interoperate through FFI, which is a language binding scheme through C dynamic libraries. I intend to submit it to iOS App Store.
Problems
The Dart FFI sample on accessing C-struct works on macOS through dynamic liking and binding. Now dynamic linking is technically possible on iOS according to Xcode 9 - No option to create dylib project iOS, however, it's unclear to me how to ship the app to AppStore, because dynamic linking is not allowed according to Apple Guidelines Section 2.5.2.
2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they
download, install, or execute code which introduces or changes
features or functionality of the app, including other apps.
Educational apps designed to teach, develop, or allow students to test
executable code may, in limited circumstances, download code provided
that such code is not used for other purposes. Such apps must make the
source code provided by the Application completely viewable and
editable by the user.
Quite a few SO questions confirm this problem, such as:
can I use dynamic library(shared object) in my iphone app?
Will Appstore reviewers allow us to use dynamic library in iOS8?
Then official flutter documentation says
Dynamically linked libraries are automatically loaded by the dynamic
linker when the app starts. Their constituent symbols can be resolved
using DynamicLibrary.process. You can also get a handle to the library
with DynamicLibrary.open to restrict the scope of symbol resolution,
but it’s unclear how Apple’s review process handles this.
Questions
As of the date when I post this (2020), does this say that I could never ship an app using this architecture to App Store?
Is it possible that I static link my C/C++ code into a single binary of a flutter app? Take Unity as an example, their iOS plugin system recompiles the plugin into native app. If flutter has a similar mechanism, how?
The answers saying you can't use dynamic libraries on iOS date to before iOS 8, when support for user-provided dynamic libraries was added.
Nothing in 2.5.2 days you can't use dynamic libraires as long as they are shipped as part of your app. So:
As of the date when I post this (2020), does this say that I could never ship an app using this architecture to App Store?
No it doesn't, as long as "this architecture" refers to using a dynamic library that you link to at build time and bundle into your application.
Adding inputs from Reddit's FlutterDev channel
#escamoteur
As I understand it you are not allowed to load any library from
outside your installation folder. Especially not downloading something
at a later point of time. Could you make this a Stackoverflow question
and tag it with Flutter?
#airflow_matt
Since iOS 8 there can be shared libraries in the bundle, when properly
codesigned I don't see why dlopen wouldn't work. Or you can link the
library with main executable itself (just like flutter does) and
dlopen self (DynamicLibrary.process()). I think it's worth a shot.
I've got the classic problem of iTunes rejecting my .ipa because it's missing a bunch of .plist entries for 'privacy-senstive data' (in my case calendar, contacts, microphone, Apple Music and Siri!), despite my app having nothing to do with these frameworks.
I want to work out which 3rd party frameworks in my app are triggering this problem, rather than take the easy way out and just add the .plist entries.
Is there a way to analyse your .ipa or the files it contains to work out which 3rd party dependency is causing this issue?
Just to be clear, I understand I could just add the required .plist entries and this problem would go away - my question is specifically how to work out which dependencies are triggering this problem.
despite my app having nothing to do with these frameworks.
Is your Link Behavior in your release configuration set to Don't Link?
If so, the non-stripped Xamarin.iOS.dll references everything and will cause all kinds of privacy/entitlement issues just due to the fact that your app is linked to them but actually never uses them.
The default Release configuration used to be Link Framework SDKs Only (-linksdk) but in the recent releases that does not seem to be the case even though the documentation states that it is.
Change the behavior to Link Framework SDKs Only, create another archive and ipa and see if Apple likes that version ;-)
I am starting to get friendly with deep linking and have read about universal links in iOS 9.3 above. I want to open my app from an email through deep linking.
I am able to do it with deep linking using universal links but how do I do it for below versions. Please help.
You have to use a custom URI scheme. Obviously you also need to do OS version detection to make sure you are using the appropriate approach.
The recommendation to try Firebase Dynamic Links or Branch (full disclosure: I'm on the Branch team) is a good one; it will save you a lot of work and headache.
i have developed an iOS app and i'm using many 3rd party libraries suck as Google, Facebook, VLC ect, when i generate IPA i'm getting 92,5MB and when i upload it to appStore i get 200MB.
Is there a way to decrease it to arround 60MB ?
Make sure you have all optimisation switched on in Build Settings.
And yes, sometimes its easier to check library code on GitHub (if it open sourced) and implement necessary logic manually, that include whole library in the project. Swift projects quite bulky, need to keep all runtime libraries inside the app
I find myself in a situation which may be unique. Please be patient, because this is going to be complex.
I am charged with creating for iOS 1) an SDK, which has taken the form of a framework , 2) a demo application, and 3) a reference application.
The SDK uses OpenCV, and so the OpenCV framework is automatically embedded inside it.
The project for the demo application at compile time automatically builds the SDK and includes a copy within itself. The demo application also links directly to the copy of OpenCV within the SDK.
The reference application is an example application meant to show people how to use the SDK framework.
So far all of this somehow works. <TAKE A BREATH>
The latest version of the demo application, however, has a problem. I need to get a copy of it into TestFlight. Despite it working fine on actual iPhones AND Xcode archiving it with no problems, nothing I have done has gotten it all the way through the App Store/TestFlight submission process. The furthest I've managed is to coerce it is that it got through validation, but when I tried submitting the app, after uploading Xcode complained:
ERROR ITMS-90034: "Missing or invalid signature. The bundle
'org.opencv' at bundle path
'Payload/FakeName.app/Frameworks/FakeNameIOSSDK.framework/opencv2.framework'
is not signed using an Apple submission certificate."
I have indeed verified that OpenCV (at least version 2.4.9 downloaded from the Website OpenCV.org) is not signed. I made an attempt to sign OpenCV with codesign, but I couldn't make that work.
The question is: What do I need to change to make the App Store happy enough that I can get my app into TestFlight? Is there some way to hide the lack of code-signing of OpenCV? Is there a way to get OpenCV properly code-signed such that the App Store is happy with it? (I have a strange vision of compiling the source of OpenCV directly into my SDK, but the size and complexity of OpenCV is such that I'd rather not try such a thing except as a measure of last resort.)
Alternatively, I find myself wondering about whether it is workable to not embed OpenCV in my SDK, but embed it within the app instead. This is what I did with the last release of the demo app in TestFlight. However, when I created the reference app, the system failed to work, leading to the current oddity of a framework within a framework.
Thanks in advance for any help anyone can provide.