Skip to content

Add OneSignal to app without transitively linking against CoreLocation #1536

@hakonk

Description

@hakonk

It seems that the default behavior of OneSignal is to link against its OneSignalLocation, which in turn imports CoreLocation. This means that, even if the said code path is never reached, Apple will prompt you with a warning when submitting the app to the App Store if the NSLocationWhenInUseUsageDescription is not in the app's Info.plist.

This is, in my opinion, unfortunate as one would have to come up with a reason for NSLocationWhenInUseUsageDescription even if the feature will never be used. Judging from the code in OneSignalLocationManager, the dynamic features of the Objective-C runtime are heavily employed, which leads me to believe one has tried to use CoreLocation without employing the types exposed via the framework's interface. That is, in a way where CoreLocation is possibly linked, but not necessarily. This leads me to believe an attempt to make use of CoreLocation only for certain conditions when it is linked has been made, possibly to for occasions where the app programmer does not want to link against CoreLocation and manage the privacy implications. CoreLocation is however imported unconditionally.

As location services for push notifications are not strictly needed, I believe the cleanest approach would be to conditionally link against OneSignalLocation only if such features are necessary for the app consuming the OneSignal SDK. That is, the app programmer explicitly adds OneSignalLocation to the Podfile as a dependency when this functionality is needed.

Are my assumptions correct? Please advise me if I have missed anything related to how to disable CoreLocation for OneSignal. For the record, I'm using the Expo plugin for React Native to add OneSignal as a dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions