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)
Related
I have very little experience in native iOS development but my current job is to wrap some specific native iOS framework to use it in React Native.
Preliminary data: common React Native tools generate an empty iOS library project and an example iOS app project that utilizes this library.
First I've tried to add the needed framework directly to the example app using CocoaPods - and it works fine, the framework became a part of linked libPods.a file, then if I add
#import MyTargetFramework;
to AppDelegate.m I can access different methods of the framework from it.
Next I switched to my iOS library project, applied the same setup (created a Podfile, added the same pod MyTargetFramework to it), then added the same #import MyTargetFramework to *.m file - but got a build error:
Module 'MyTargetFramework' not found
Also I've noticed that there is no libPods.a for iOS library project, all the pods are merged to a Pods.framework instead.
So my question is - what am I doing wrong? Why does it work for iOS app project, but not for iOS library project? How can I properly link my target framework to my own iOS library? I've already spent some time googling, but found nothing about app vs lib differences from this point.
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.
I have a swift framework and I use on objective c project. I create a fat framework with script. It works till Xcode 10.2.
I try to create fat framework on Xcode 10.2. It compiled successful but when I added on my objective-c project it not working on simulator.
Apple's release notes include my error but I didn't work. (https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes in known issues)
How can I create fat framework headers file for simulator?
Try this one
https://gist.github.com/closerminds/8a8d8db6f87d2a65c4487f396f986737
This use the workaround proposed by Apple
I am going to create a Cocoa Touch Framework library and I am confused how they work on iOS. What would happen if there are different apps installed on a device that use different versions of that library?
Would each app has access to its own version of the framework or they will share some single version of it?
How would that single version would be determined then?
Logically thinking each app should own its own version, but I am not sure how frameworks and dynamic libraries work on iOS. Thanks for the help.
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.