How to import a dynamic framework to existing Project

I followed following steps to add a framework to my existing application:

1) Create sub-folder in your project and add framework into that folder.

2) Now, open Build Phases -> Link Binary With Libraries. And click on '+' button.

3) Then click on "Add Other" instead of adding default framework


This framework is built keeping in mind that it will support ios6 and onward

Application is crashing on launch ...below are the crash logs ..


Incident Identifier: F7C7AD86-02FC-42B1-8267-5ED3B7A52565

CrashReporter Key: 3da6453e3c1e95321d42b61b7378d13fed6e8b82

Hardware Model: iPad4,1

Process: HSky [576]

Path: /var/mobile/Applications/20E61238-CFFA-4E90-BEAB-42FFE5F9B1AF/HSky.app/HSky

Identifier: com.hds.hiphone

Version: 5.11.2_R (5.11.2_R)

Code Type: ARM-64 (Native)

Parent Process: launchd [1]



Date/Time: 2015-11-29 14:31:46.067 +0530

OS Version: iOS 7.0.4 (11B554a)

Report Version: 104



Exception Type: EXC_BREAKPOINT (SIGTRAP)

Exception Codes: 0x0000000000000001, 0x00000001200f9098

Triggered by Thread: 0



Dyld Error Message:

Library not loaded: /Library/Frameworks/FlixSDK.framework/FlixSDK

Referenced from: /var/mobile/Applications/20E61238-CFFA-4E90-BEAB-42FFE5F9B1AF/HSky.app/HSky

Reason: image not found

Dyld Version: 324



Binary Images:

0x1200f8000 - 0x12011ffff dyld arm64 <b9f4cfd5259d389887ae4f252ac88b71> /usr/lib/dyld

0x186c9c000 - 0x186e27ff7 CoreFoundation arm64 <da5c56450a6632b3b4349eb9de5f1091> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation

0x187d00000 - 0x187f63fff ImageIO arm64 <f9733403c35f375b817af86d57e5b842> /System/Library/Frameworks/ImageIO.framework/ImageIO


Please help to resolve this issue.

That's not the crash log; that's the console log. Check the Devices window in Xcode - select your device and click the Device Logs button. Hopefully there'll be an actual crash log there with some better info.

Hi Junkpile ... I have updated my post with Crash Logs ... can u plz help now to resolve the issue.

From the reason "image not found", I guess it's not correctly linked.


One way to easily import your framework is to just literally drag and drop it into the "Embedded Binaries" section of your target (General tab).

It would then display a dialog, select both "Copy if needed" and "Create Group".


After that, the framework should appear in both "Embedded Binaries", "Linked Frameworks and Libraries" in the General tab, as well as "Link Binary With Libraries" and "Embed Frameworks" in your Build Phases tab.


Hope it helps.

Hi EinharchAltPlus,


Thanks for your reply ... but Embedded Binaries is supported in ios8 and above.

We want to support ios6 and ios7 also.

While uploading as Embedded Libraries on itunes connect we are getting many irrecoverable errors.

Please suggest something were we can use use it as dynamic framework

Hi Junkpile...

Can u please help me to resolve the above issue

Oh, sorry, I can't help on this one.


Possible leads:

- I know some people doing many workarounds, such as weak linking the library ... But unsure how well it would do on earlier than iOS7

(search for quellish / Weakness on GitHub for an example).

- A more technical and harder solution would to use dlopen for example (a good description in Apple's documentation at: "Dynamic Library Usage Guidelines"). And you can check Facebook's open sourced iOS SDK to see how they do it in practice (mostly in FBSDKDynamicFrameworkLoader.m)



Personal thoughts:

I'd avoid doing that because officially, only iOS8 onward are supported, you'll have many troubles making the app work, and your app can be rejected even if you succeed.

I'd also ask the question if there's really any need to support iOS6, if a large chunk of your userbase is on iOS6, then you have a problem: you are missing the 99% of App Store users (check App Store access statistics, it counts updates, as people have to access the store to update their devices).

One last point to consider: If the library is a dynamic one, chances are it was built against iOS8 onward and using methods nonexisting in iOS6/7, so even weak linking and avoiding crashes, anything related to the libraries won't work on iOS6/7 ... So consider if it's a good thing to deliver an update to these users that is, at best, buggy, and offers no extra functionality.



An alternative solution: Get older static libraries if it exist, weak link it as well, and in code check which version of iOS it is before including the headers.

How to import a dynamic framework to existing Project
 
 
Q