Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress `warning: linking against dylib not safe for use in application extensions`?

I have a dynamic framework that is shared between an iOS application and an extension. There is some code in that framework that references UIApplication, that is of course, not usable in an extension. Those calls are completely isolated and so I am not worried about them causing problems with my extension.

Since there isn't a flag specified in the warning message, perhaps there isn't way to do it, but how do I suppress warning: linking against dylib not safe for use in application extensions when building my project?

like image 990
Wayne Hartman Avatar asked Feb 21 '15 22:02

Wayne Hartman


2 Answers

For your watch/today-widget extension target (so not your app or libray target), go into the project settings and change the build setting APPLICATION_EXTENSION_API_ONLY / Require Only App-Extension-Safe API to NO.

like image 117
Oliver Pearmain Avatar answered Sep 22 '22 12:09

Oliver Pearmain


I think you can use embedded framework to share code between your app extension and its containing app. But you have to be careful that your framework doesn't contain apis which are unavailable to extensions. See Some APIs Are Unavailable to App Extensions and Using an Embedded Framework to Share Code.

If your framework doesn't contain such apis don't forget to set Require Only App-Extension-Safe API to YES in your framework target's Build Settings.

enter image description here

As a second way to share source files between application and extension, you don't have to create a separate framework target. You can just share source files by targeting both two projects.

enter image description here

like image 40
abdullahselek Avatar answered Sep 21 '22 12:09

abdullahselek