google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.8k stars 293 forks source link

Using Promises on an application extension #57

Closed umdemir closed 6 years ago

umdemir commented 6 years ago

First of all thanks for this beautiful library! I have a small problem with it.

I am trying to use Promises in a network extension and getting these ld warnings:

ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/umit/Desktop/code/meshkat_ios/Carthage/Build/iOS/FBLPromises.framework/FBLPromises ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/umit/Desktop/code/meshkat_ios/Carthage/Build/iOS/Promises.framework/Promises

According to documentation, submitting my app to iTunes Connect without clearing these warnings will cause a rejection.

https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html

Again from documentation:

"To configure an app extension target to use an embedded framework, set the target’s “Require Only App-Extension-Safe API” build setting to Yes. If you don’t, Xcode reminds you to do so by displaying the warning “linking against dylib not safe for use in application extensions”."

shoumikhin commented 6 years ago

Hi Umit, many thanks for reporting the issue!

The good news is Promises doesn't use any non-safe APIs and we do ship app extensions successfully that use Promises internally.

How exactly do you integrate the framework (SwiftPM, CocoaPods, Carthage, etc.)?

I do see we're lacking APPLICATION_EXTENSION_API_ONLY flag in xcodeproj set to YES. Feel free to make the change (see the screenshot attached on which Xcode build option should be toggled) and send us a PR, if that fixes the issue for you.

If you integrate Promises with CocoaPods, that flags should also be set in your generated project, presumably.

Thanks.

ghost commented 6 years ago

Updated in PR58. Thanks, Umit, for the PR!