warning message linking against a dylib which is not safe for use in application extensions
Asked Answered
C

2

16

I am receiving an error that says

linking against a dylib which is not safe for use in application extensions

I have looked at the other questions that address this, the only one that had answers did not solve my problem, and the rest had received no answers at all.

I tried just building a framework with nothing in it at all, and adding the framework to Linked Frameworks and Libraries in the General tab of my intents app extension, and I still get this message.

When I add code to the framework, I still get the warning message.

Here is my code:

import UIKit

class Widget: NSObject {

}

I am sure to follow instructions at Some APIs Are Unavailable to App Extensions and at Using an Embedded Framework to Share Code but I still get the same warning message. I have read that Apple App Store will not pass my app for review if I have this issue.

Caldron answered 19/10, 2018 at 2:58 Comment(0)
D
31

If you are linking against a framework you control, select the framework target in your project. In the General tab, look at Deployment Info and you will see a line:

App Extensions: [ ] Allow app extension API only

Select the checkbox, and you should be able to link against this framework.

This checkbox ensures that only calls to APIs that are valid within App Extensions are used. Framework Target General Tab

Dorsoventral answered 25/10, 2018 at 17:40 Comment(0)
R
5

In Xcode 14, I couldn't find the checkbox shown in @lar3ry's answer.

However, the setting can still be found in the "Build Settings" tab under Build Options > Require Only App-Extension-Safe API. Make sure to select "All" setting, not only "Basic":

enter image description here

The xcconfig-style build setting name is APPLICATION_EXTENSION_API_ONLY.

Rupee answered 14/9, 2022 at 4:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.