https://github.com/below/weaklink
A sample for a weak linking question
https://github.com/below/weaklink
Last synced: 8 months ago
JSON representation
A sample for a weak linking question
- Host: GitHub
- URL: https://github.com/below/weaklink
- Owner: below
- License: unlicense
- Created: 2014-11-03T17:10:35.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-03T21:35:33.000Z (over 11 years ago)
- Last Synced: 2025-07-02T15:50:16.320Z (9 months ago)
- Language: Objective-C
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
WeakLink
========
These projects demonstrate my question if `UIUserNotifications` can be weak linked directly, or if I have to use `NSClassFromString`, as I currently do as a workaround
In the [Documentation](https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html "NextPrevious
Using SDK-Based Development") Apple says that:
> For iOS frameworks that support the `NS_CLASS_AVAILABLE` macro, conditionalize your code for weakly linked classes as demonstrated in the following example:
> `if ([UIPrintInteractionController class]) {
> // Create an instance of the class and use it.
> } else {
> // Alternate code path to follow when the
> // class is not available.
> }`
Conditions for this are:
> * The base SDK for your Xcode project must be iOS 4.2 or newer.
> * The deployment target for your project must be iOS 3.1 or newer.
> * The compiler for your project must be the LLVM-GCC 4.2 compiler or newer, or the LLVM compiler (Clang) 1.5 or newer.
> * You must ensure that any frameworks not available in your project’s deployment target are weakly linked, rather than required.
However, for `UIUserNotificationSettings` I will get: `Undefined symbols for architecture armv7: "_OBJC_CLASS_$_UIUserNotificationSettings"` if linked for iOS 7.
Is this a bug?