BugfenderSDK-iOS icon indicating copy to clipboard operation
BugfenderSDK-iOS copied to clipboard

APPLICATION_EXTENSION_API_ONLY setting

Open fortmarek opened this issue 4 years ago • 5 comments

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

fortmarek avatar Jan 07 '21 09:01 fortmarek

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

RubenVot avatar Jan 07 '21 10:01 RubenVot

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?

fortmarek avatar Jan 25 '21 11:01 fortmarek

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.

jgimenez avatar Mar 25 '21 00:03 jgimenez

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.

olejnjak avatar Jul 08 '21 08:07 olejnjak

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.

jgimenez avatar Jul 21 '21 10:07 jgimenez