flutter_background_geolocation
flutter_background_geolocation copied to clipboard
Objective-C classes should be prefixed
Currently most of the Objective-C classes in this plugin have no prefix. This violates Apple's recommended practice for library code, which is very dangerous since collisions would cause undefined behavior at runtime.
Adding a specific-to-this-plugin prefix (e.g., FBG) to all Objective-C classes, per Apple's guidelines, would make it much less likely that someone using this plugin would end up with undefined behavior in their application.
See also https://github.com/transistorsoft/flutter_background_geolocation/issues/1144
Your Environment
- Plugin version: N/A
- Platform: iOS
- OS version: N/A
- Device manufacturer / model: N/A
- Flutter info (
flutter doctor): N/A - Plugin config: N/A
N/A
Expected Behavior
The plugin class uses a 3-letter prefix unique to this plugin.
Actual Behavior
No prefix on most classes.
Steps to Reproduce
N/A
Context
N/A
Debug logs
Logs
N/A
Fair enough.
Released to 4.13.2
FYI, Apple explicitly reserves all two-letter prefixes for their own use (per the documentation linked above), so while you've avoided potential conflicts with future Flutter-team-authored code, you are now subject to collisions with Apple code in any future iOS release. Third-party code is supposed to use three-letter prefixes.
I'm satisfied for the time-being.
I would urge you to consider the fact that the new situation is significantly more dangerous than the one you fixed with the change. Previously a collision could only have happened if one of the clients of your plugin updated to a new version of Flutter and rebuilt, which means they at least would have an opportunity to discover the problem pre-release.
With this version, existing, published applications are subject to undefined behavior when the users of the application update to a new version of iOS, without any change by the application developer.
I'm satisfied for now. I've been doing this for over 9 years without issue.
I've been doing this for over 9 years without issue.
Yes, the nature of this class of problems is that it works fine as long as there are no collisions, and then suddenly if there are—which is impossible to predict in advance—it is likely catastrophic. I've been writing Obj-C code since before iOS existed, and have seen this happen in the wild with modules that did not follow Apple's guidelines, including cases where applications were suddenly rendered completely useless due to crashes on launch.
If you are set on not changing this, I sincerely hope for the sake of your plugin's clients and their customers that Apple doesn't ever happen to use this prefix.
It'll be fine. Relax.
I’ve had a review of this thread. I will implement a 3-letter namespace.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.