Chris
Chris

Reputation: 748

Load framework only when found (For example CoreTelephony.framework)

The application I'm currently developing needs to show the carrier name on a screen. I know how to achieved this with the CTCarrier class from iOS 4.0. But unfortunately my app needs to also run on the older system versions (back to iOS 3.0). This is a requirement I cannot change.

From the code this should not be a problem, as I can test if the class exists and only show the name when the app is running under 4.0. But the problem I have is that as soon as I link the CoreTelephony framework in my project the code cannot be run on a phone with an older system version. The app will crash with an error message:

dyld: Library not loaded: /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
Referenced from: /var/mobile/Applications/6F3E2582-0364-42F4-9A65-D98B40987509/XYZ.app/XYZ
Reason: image not found

Is there a way to only load the framework when it is found on the system? Or is this not possible.

Upvotes: 2

Views: 1556

Answers (1)

Vladimir
Vladimir

Reputation: 170859

In your project go to Target info / General tab / Linked libraries section - set type as weak for your framework there

Upvotes: 4

Related Questions