Adding a framework to existing project - ios

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.

Related

Shared framework between iOS and tvOS

I am trying to build a crossplatform framework that can be embeded both in and iOS and a tvOS application.
This framework does NOT contain anything related to UI but is a wrapper around CoreBluetooth.
What I explored ?
It compiles when I set the base sdk to tvOS, and when I set the base sdk to iOS. But I do not know how to make it work for both
Do you know how I could have both at the same time ?
Thanks
Stan
You'll have to create two different targets in your xcodeproj, one for iOS, and one for tvOS.
Then simply add both target as Target Membership for your swift files.

iOS: When to choose a Cocoa Touch Static Library or Framework?

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.

How to build a framework for all platforms in single Xcode project?

Previously to build a framework for particular platform(macOS, iOS), I used to maintain different projects in Xcode and build separately.
My code mostly depends on sqlite3.h and a wrapper class written in Swift.
Is there a way to maintain all the frameworks under one xcode project?
I searched but I didn't get any tutorials on the web.
Thank you.
yes of course xcode can handle this for a long time. you simply create your framework project and then add targets for iOS, macOS, tvOS and watchOS.
the plus sign below the target pane allows you to add more target. or just duplicate your existing target and change sdk and platform settings.

iOS Framework which can support iOS7

I have very simple requirement for my iOS SDK
-Support iOS 7 and above.
-Include some swift code to my SDK
Problems:
-With iOS 8, Xcode allowed us to develop cocoa touch frameworks, but they can only be run on iOS 8 and above.
-If I create a static library, I cannot include swift code.
-I was using using Real Framework, but Real Framework does not get installed with Xcode 7.
So, What does a poor developer do ?
You can always have an alternative distribution method for your SDK for users that are targeting iOS 7.
You can offer an SDK in a single concatenated file, that is simply merging all your project source files, which user can drop into project tree and compile together with all the other source files. This applies only when you have either Swift-only or Objective-C only SDK
If SDK user uses workspaces, he may embed your SDKs .xcodeproj directly in his project
Anyway both methods require source code distribution as the user needs to compile the code from within his project. Dependency maintenance is also more difficult.
For a reference you can check how it is done in:
https://github.com/SwiftyJSON/SwiftyJSON
It is a Swift library, but integration with iOS 7 based projects is the same.
I could not find any solution for this. I compromised:
I am NOT using swift code.
I am distributing static library (.a file and a .h header file) instead of a framework. (this is to support iOS 7)

Xcode 4.6 doesn't recognize linked frameworks correctly for Xcode 5.0 created project

I've created a project in Xcode 5.0 (yes, Developer Preview) for the beta iOS7 software because I wanted to play around with the new beta stuff. But I actually decided to submit the App I was playing around with to the App Store and since this is not possible with preview Xcode versions I fixed all compatibility issues to make the code work with Xcode 4.6.3 and iOS 6. Except for one thing.
And that's importing third party frameworks like Flurry (analytics framework) or Crashlytics (crash reporting framework).
Both are correctly imported and set up with targets (it's all working in Xcode 5.0) but I'm getting a 'Crashlytics/Crashlytics.h' file not found in the line I'm importing the needed classes (#import <Crashlytics/Crashlytics.h>) in Xcode 4.6.
The same is true for the Flurry framework analogously. The crazy thing is, both libraries show up in the targets 'Link Binary With Libraries' list, even in Xcode 4.6.
Does anyone have an idea how I can get things work in Xcode 4.6? Are there any further ways to influence the importing?
The link binary with libraries is not the issue here. You have to confirm your Header Search Paths in your build settings. I think Xcode 5 might use a different variable for it, and that is why Xcode 4.6 will get confused (just a guess though). Anyway, confirm that the path to those headers is in your Header Search Path. The Crashlytics app will automatically add it for you, actually.

Resources