Closed andersborgabiro closed 6 years ago
I am having the same problem. iOS 10.3. I commented on the issue #283 you referenced above.
Is this plugin being actively maintained?
It doesn't seem to be maintained anymore. Peter Metz would know.
I added cordova-plugin-ios-ble-permissions, that I use in another project, but that didn't change the behavior, and AFAIK it was only needed to get the other project approved by Apple.
There's at least one critical pull request, so it would be a bummer if it's not worked on anymore: https://github.com/petermetz/cordova-plugin-ibeacon/pull/305
As I use PhoneGap Build, I can't make use of pull requests, unless they are also published.
@andersborgabiro @brandon-applied Can you confirm that the capabilities are set correctly in Xcode?
I just added a new screen to the quickstart app (v2.1.0) and it works fine, but only if I have this set:
I tried cordova-custom-config with these settings:
<config-file platform="ios" target="*-Info.plist" parent="UIBackgroundModes">
<array>
<string>location</string>
</array>
</config-file>
<config-file platform="ios" target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
<string>This app requires constant access to your location in order to track your position, even when the screen is off.</string>
</config-file>
<config-file platform="ios" target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
<string>This app will now only track your location when the screen is on and the app is displayed.</string>
</config-file>
NSLocation... show up in the IPA Info.plist, but not UIBackgroundModes. The syntax is according to examples at https://www.npmjs.com/package/cordova-custom-config.
I also tried invoking cordova-plugin-ble-central, assuming it would set it, but that didn't fix it.
I'll do some more experimenting and report back if I get this to work.
I also added this (as recommended by another issue report), to no avail.
var delegate = new cordova.plugins.locationManager.Delegate();
cordova.plugins.locationManager.setDelegate(delegate);
@andersborgabiro If the UIBackgroundModes setting is missing, it probably won't ever work. So in my opinion you should focus on the root cause of that. If I remember correctly you are using Phonegap Build, maybe the right direction is to check with their issue tracker if this has a known solution specific to PGB?
cordova-plugin-config won't work with PhoneGap Build:
This plugin WILL NOT WORK with remote ("Cloud") build environments that do not support the execution of this plugin's hook scripts. This includes: Phonegap Build Intel XDK Telerik Appbuilder Ionic Cloud
I haven't found any plugin that specifically sets UIBackgroundModes to location. cordova-plugin-background-mode sets it to audio though.
This is not very critical, so I'll leave it be for now.
confirming, for further reference: as @petermetz stated, Background Mode -> Location updates must be enabled to use ibeacon advertising.
I could add the setting. I missed that they changed to edit-config in cli-7.0.1, so this does it (for <platform name="ios">
in config.xml). Still, the app has to be visible for advertising to work.
<edit-config file="*-Info.plist" target="UIBackgroundModes" mode="merge">
<array>
<string>location</string>
</array>
</edit-config>
This means there's no need for cordova-plugin-custom-config in this case (that didn't help anyway), even for PhoneGap Build, Ionic and similar.
Advertising also works in iOS 11 with the above setting. The question asked is different, but I chose "Always". Having the app visible still applies.
Added an entry about this to the FAQ: https://github.com/petermetz/cordova-plugin-ibeacon/blob/v3.x/FAQ.md
Thanks for the investigation @andersborgabiro
I made a simple beacon advertiser app for iOS some time ago, and the published version still works, but when building with the latest cordova-plugin-ibeacon for cli-6.5.0 or cli-7.0.1 there's now no advertising taking place. To be on the safe side I now follow the example given in the documentation precisely.
Thanks in advance for any pointers, Anders
Verified:
A code snippet of the essentials:
...