Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPLICATION_EXTENSION_API_ONLY setting #63

Open
fortmarek opened this issue Jan 7, 2021 · 5 comments
Open

APPLICATION_EXTENSION_API_ONLY setting #63

fortmarek opened this issue Jan 7, 2021 · 5 comments

Comments

@fortmarek
Copy link

Hi! 👋

We are using your framework throughout our app and now we we'd like to use in our widget, too.

Now, widgets are more restrictive in what API you could use - eg if you used UIApplication.shared in your widget, it'd crash.

To make sure that this does not happen, it's recommended to set APPLICATION_EXTENSION_API_ONLY setting to true. With that turned on, xcodebuild statically checks your code for whether you use API not allowed in widget. It does so for transitive dependencies, too.

Since the check is done statically, it can not do that for dynamic frameworks. Thus, if you import a dynamic framework that does not have the aforementioned setting turned on, it'll warn you with a message linking against a dylib which is not safe for use in application extensions: ....

We integrate Bugfender via SPM - which imports libraries statically - but BugfenderLibrary imports BugfenderSDK dynamically, so we get that warning anyway.

As the BugfenderSDK framework is closed source, would it be possible to set APPLICATION_EXTENSION_API_ONLY to true?

FYI: we are using the latest version, 1.10.0

@RubenVot
Copy link
Contributor

RubenVot commented Jan 7, 2021

Hi @fortmarek,
Thanks a lot for the exhaustive report. That's definitely a good idea, I will open a new ticket in the internal system and will try to discuss with the team asap.

I'm not sure if this can be helpful but in the release page you can download bugfender as static library as well: https://github.com/bugfender/BugfenderSDK-iOS/releases/tag/1.10.0 or following this link

@fortmarek
Copy link
Author

Hi @RubenVot!

Thanks for the response! We're considering integrating bugfender manually to integrate it statically, but I'd rather not do so - is there any progress on this?

@jgimenez
Copy link
Member

Our code actually uses UIApplication.shared, so we can not enable that flag for now. We'll need to find out if it's possible to just make some of the API unavailable to extensions.

@olejnjak
Copy link
Contributor

olejnjak commented Jul 8, 2021

Hello, how does it look few months later? It is pretty annoying to have 10+ warnings in project because of a single dependency and can easily cause that we will miss some really important warning.

By using the @available/#available directives it should be simple to mark functions that should not be available to app extensions.

@available(iOSApplicationExtension, unavailable)
public func onlyForAppsNotExtensions() {
...        
}

Then Xcode will not suggest that function in extensions and will not compile if used there giving error, it is not available in app extension.

Thanks.

@jgimenez
Copy link
Member

Hi @olejnjak, there are deep implications so it's not that easy of a change, although we're working on it. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants