I have a proprietary, dynamic iOS framework targeting iOS 8.0 above and using Swift. I want to distribute this in a precompiled form.
I tried building for release, copying over the framework to another project and adding it under the Embedded Frameworks section. However, I get the following error:
ld: framework not found MyFramework
If I remove my framework from the Linked Frameworks and Libraries section, my app compiles, but I cannot use the framework in my code.
How can I solve my problem?
Related
I am trying to make an ios app with a dylib as framework instead of the standard .framework or .xcframework structure.
Does the app store review work with such a shared library structure.
I see from here that it might not be supported.
https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING-BUNDLE_ERRORS
https://developer.apple.com/forums/thread/125796
Has anyone tried an app with a dylib inside ? Or it has to be packaged as framework instead ?
From your first link:
Dynamic libraries outside of a framework bundle, which typically have
the file extension .dylib, are not supported on iOS, watchOS, or tvOS,
except for the system Swift libraries provided by Xcode.
That seems unambiguous in saying that you can't include a dynamic library outside a framework.
Can I use a .xcframework inside a .framework?
When I try this the framework target builds fine, but when I use this framework in an iOS app target, it gives build error
For eg:
MyApp is iOS app target
MyFramework is a framework (embedded in MyApp)
MyXcFramework is a xcframework (embedded in MyFramework)
A sample swift file inside MyFramework contains
import Foundation
import MyXcFramework
and builds successfully
But when MyFramework is added to MyAapp i get the following error
import Foundation
import MyXcFramework <- No such module MyXcFramework
Can anyone help what I am doing wrong?
It seems like you are trying to use the xcframework without adding it to the app. If you want to use your xcframework in your app too you have to add that xcframework in your app target, you can avoid embedding xcframework in the framework and only embed for the app itself.
According to the documentation, it is not allowed in iOS. Apps with Dependencies Between Frameworks
An umbrella framework is a framework bundle that contains other frameworks. While it is possible to create umbrella frameworks for macOS apps, doing so is unnecessary for most developers and is not recommended. Umbrella frameworks are not supported on iOS, watchOS, or tvOS.
I had a framework, that had subframework, everything compiled sucessfuly, I shared the app with Diawi link. QA approved the build. When I tried to upload the build I had following error.
I am integrating FrirebaseCrashlytics SDK in tvOS and iOS without cocopods. I downloaded their xcFramework. But I can't use the xcFramework as the project is not compatible so I drag and drop ios-armv7_arm64 framework to project and added Firebase.h and module.modulemap (my project uses both objc and swift). Also, I specified the Firebase.h in the bridging header. I get below error when I build.
Showing Recent Errors Only
/Users/xxxxx/Code/ios/tvOSApplications/App/App/Firebase.h:15:9: 'FirebaseCore/FirebaseCore.h' file not found
Showing Recent Errors Only
/Users/xxxxx/Code/ios/tvOSApplications/App/App/App-tvOS-Bridging-Header.h:27:9: Could not build module 'Firebase'
Multiple problems to address (based on instructions in the README at the base of the distribution:
The zip distribution requires Xcode 11 which supports xcframeworks
The zip distribution only supports iOS. tvOS is only distributed via CocoaPods
All Firebase installations require the xcframeworks in the Analytics folder to also be installed.
I am able to get firebasecrashlytic .framework files without cocopods using Carthage. I copied files to project and it works in iOS project. I am looking for a similar solution for tvOS
Recently I had a similar requirement of supporting Firebase on both iOS and tvOS. As the frameworks are available only on iOS and not on tvOS. I could not integrate Frameworks. So the solution I followed is adding of Source files provided in https://github.com/firebase/firebase-ios-sdk corresponding to the required modules that are needed for enabling Firebase Crashlytics.
This solution worked for me and able to see the crashes. Let me know if you need more information
I got Firebase Crashlytics working for tvOS without Cocoapods or XCFramework bundles. Basically, you just need to bring over the source files, set the header search paths, and set all the required preprocessor macros. You can read the story here.
Thanks for the hint Gangadhar!
To begin: I read the other questions here, but they are stating that e.g. Swift cannot be used in a Framework or/and Library or are outdated (5 years old).
What are the advantages and downsides of a Cocoa Touch Framework vs. a Cocoa Touch Static Library for achieving this?
I´m trying to share code between two iOS targets, e.g. an iPhone target and an iPad target (Universal target is not wanted here).
If I understand it correctly, the Static Library and the app code will be merged together into one Binary, while the combination of Framework and app code will be two binaries. I guess this means more signing and more DSYM files to upload to crash reporting tools?
Also, a Framework should/could also work standalone while a Static Library always needs other code.
What about Tests, Distribution to the App Store, Debugging (Breakpoints) and compile time? Which option performs better for what task?
Some clarifications of Static vs Dynamic Frameworks: iOS Static vs Dynamic frameworks clarifications
Language: As for the use of Swift, before you couldn't create a Static Library with it, but from Xcode 9 onwards you can. So I guess Swift vs. ObjC wouldn't be a problem. Haven't found any tutorials on creating Static Libraries with Swift, just for creating Frameworks (for example: https://www.raywenderlich.com/5109-creating-a-framework-for-ios). So maybe a Framework would be easier in terms of finding resources/references.
dSYM: Citing an answer from an Apple Staff: "If you are building the framework as a dependency of your app target, the dSYMs for the framework will be present in the archive you create when archiving the app for distribution. If you are using a framework provided by a vendor that is already compiled, you will need to contact the framework vendor about the dSYMs." (https://forums.developer.apple.com/thread/70716). As for Static Libraries, they would be less work in terms of the dSYMs you handle. (Why does not Xcode generate dSYM for static library)
Codesigning for Frameworks: "Developer is free to distribute iOS framework without codesigning it as Consumer will re-codesign it anyway, but Developer is forced by Xcode to codesign their framework when they build for iOS device" (Creating iOS/OSX Frameworks: is it necessary to codesign them before distributing to other developers?)
As for Tests, adding the Framework or the Static Library on your Unit Testing target's build phases should do the job.
Breakpoints:
Static Libraries: Debugging a static library in Xcode
Frameworks: Xcode 9 - Framework breakpoints
For what I've read in the links, although Static Libraries might be a little more efficient, Frameworks are a lot less work to set up.
I'm adding a 'Cocoa Touch Framework' target to an existing project on XCode 6. Will I be able to use the built framework on older iOS versions? (iOS 6 & 7)
As far as I know you can work around and support iOS7 with dynamic libraries.
The application must weak link against the framework. To do so, in
your application target’s “Link Binary With Libraries” Build Phase,
designate the framework as “Optional”. This will weakly link against
the framework.
Then, you need to follow the guidelines provided by apple.
You can have more information and a sample project in this blog article.