-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Allow same library for app and extensions. #2737
Conversation
For reference, this is meant to resolve the continuing CocoaPods 0.36+ issues mentioned in #2321. |
Is it time we had an extension to the example project? |
We should go all out. App extension, watch app... The works. |
Will this add support for native watchOS 2 apps as well? |
WatchOS is a different story. I think it doesn't have UIKit so the iOS library from the project and the iOS cocoa pod would fail unless you just exclude the UIKit subspec. (Assuming cocoapods works in general.) These are just guesses though. |
Thanks for this @bnickel Would you want to add a Today Extension to the example project so this behavior can be verified going forward? |
Sure |
clang will silence availability errors in classes and methods that are also unavailable to the target. The following have been made unavailable to app extensions: - `AFNetworkActivityIndicatorManager` class - `UIAlertView` category methods - `AFURLConnectionOperation setShouldExecuteAsBackgroundTaskWithExpirationHandler:` Benefits of change: - Fixes CocoaPods support for App Extensions. - Allows single framework to be used in app. - Eliminates the need for `AF_APP_EXTENSIONS`.
This demonstrates that APIs not available to an extension can compile successfully if they are marked with NS_EXTENSION_UNAVAILABLE_IOS.
I've added a Today extension which validates that the code compiles with the annotated methods and classes. I can't get the Travis failure to reproduce locally. |
@@ -23,7 +23,7 @@ | |||
|
|||
#import <Availability.h> | |||
|
|||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && !defined(AF_APP_EXTENSIONS) | |||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you see any reason to not mark this whole class as NS_EXTENSION_UNAVAILABLE_IOS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember. I think I was just following the pattern of UIAlertView.h. If it compiles the other way, I'm sure it's fine.
Allow same library for app and extensions.
This is actually looks good. Just verified all the tests pass on my local machine. Thanks for putting this together! |
clang will silence availability errors in classes and methods that are also unavailable to the target. The following have been made unavailable to app extensions:
AFNetworkActivityIndicatorManager
classUIAlertView
category methodsAFURLConnectionOperation setShouldExecuteAsBackgroundTaskWithExpirationHandler:
Benefits of change:
AF_APP_EXTENSIONS
.