Hi,
First of all, many thanks for your support!
My app is rejected by App Store for this reason (they say):
**********************
We noticed that your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not have any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.
Next Steps
To resolve this issue, please revise your app to include features that require the persistent use of real-time location updates while the app is in the background.
If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.
**********************
It is true, for my app I need to have a background running that works perfectly updating location. So my code (fragments) is:
Could someone explain, why Apple is not happy with my app?
I didn't understand this point:
******************
You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.
******************
Thanks in advance!
First of all, many thanks for your support!
My app is rejected by App Store for this reason (they say):
**********************
We noticed that your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not have any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.
Next Steps
To resolve this issue, please revise your app to include features that require the persistent use of real-time location updates while the app is in the background.
If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.
**********************
It is true, for my app I need to have a background running that works perfectly updating location. So my code (fragments) is:
B4X:
#PlistExtra:<key>NSLocationAlwaysUsageDescription</key><string>Track your location in the background for better ad revenue.</string>
#PlistExtra:<key>NSLocationUsageDescription</key><string>Used to display the current navigation data.</string>
#PlistExtra: <key>UIBackgroundModes</key><array><string>location</string></array>
#MinVersion: 8
#Entitlement: <key>aps-environment</key><string>production</string>
B4X:
#If OBJC
- (BOOL)isSignificantLocationAvailable {
if([CLLocationManager significantLocationChangeMonitoringAvailable]) {
return YES;
}
return NO;
}
#end if
Sub StartBackground(lm As LocationManager, MinimumDistance As Double)
Dim no As NativeObject = lm
no = no.GetField("manager")
If App.OSVersion >= 8 Then
no.RunMethod("requestAlwaysAuthorization", Null)
End If
If App.OSVersion >= 9 Then
no.RunMethod("setAllowsBackgroundLocationUpdates:", Array(True))
End If
no.SetField("distanceFilter", MinimumDistance)
no.RunMethod("startUpdatingLocation", Null)
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("Page1")
NavControl.ShowPage(Page1)
App.RegisterUserNotifications(True, True, True) 'request permission for notifications
App.ApplicationIconBadgeNumber = 0
If App.LaunchOptions.IsInitialized Then
Dim ln As Notification = App.LaunchOptions.Get("UIApplicationLaunchOptionsLocalNotificationKey")
If ln.IsInitialized Then
hd.ToastMessageShow("Application was started from a notification: " & ln.AlertBody, True)
End If
End If
fm.Initialize("fm")
WKWebView3.Loadurl("http://85.88.153.23.nip.io:7095/promotions")
Dim no As NativeObject = WKWebView3
no.GetField("scrollView").SetField("bounces", False)
LocManager.Initialize("LocManager")
'in background....
Dim no As NativeObject = LocManager
no = no.GetField("manager")
no.SetField("pausesLocationUpdatesAutomatically", False)
StartBackground(LocManager, 0) 'replaces locManager.Start
'in background....
LocManager_AuthorizationStatusChanged(0)
tn.Initialize("tn")
End Sub
Sub AllowPauseLocationAutomatically(lm As LocationManager, ActivityType As Int) 'ignore
Dim no As NativeObject = lm
no = no.GetField("manager")
no.SetField("activityType", ActivityType)
no.SetField("pausesLocationUpdatesAutomatically", True)
End Sub
Private Sub LocManager_AuthorizationStatusChanged (Status As Int)
If Not(LocManager.IsAuthorized Or LocManager.AuthorizationStatus = LocManager.AUTHORIZATION_NOT_DETERMINED) Then
Log("Not authorized")
End If
StartLocationUpdates
End Sub
Private Sub StartLocationUpdates
'if the user allowed us to use the location service or if we never asked the user before then we call LocationManager.Start.
If LocManager.IsAuthorized Or LocManager.AuthorizationStatus = LocManager.AUTHORIZATION_NOT_DETERMINED Then
LocManager.Start(0)
End If
LocManager.StartHeading
End Sub
Sub SearchForBeacon(UUID As String, Identifier As String) As Object
If LocManager.IsAuthorized Or LocManager.AuthorizationStatus = LocManager.AUTHORIZATION_NOT_DETERMINED Then
Dim no As NativeObject = LocManager
no = no.GetField("manager")
If LocManager.AuthorizationStatus = LocManager.AUTHORIZATION_NOT_DETERMINED Then
no.RunMethod("requestWhenInUseAuthorization", Null)
End If
Dim nsuuid, br As NativeObject
nsuuid = nsuuid.Initialize("NSUUID").RunMethod("alloc", Null).RunMethod("initWithUUIDString:", Array(UUID))
br = br.Initialize("CLBeaconRegion").RunMethod("alloc", Null).RunMethod("initWithProximityUUID:identifier:", _
Array(nsuuid, Identifier))
no.RunMethod("startRangingBeaconsInRegion:", Array(br))
Return br
Else
Log("Not authorized!")
Return Null
End If
End Sub
Private Sub Application_Foreground
StartLocationUpdates
End Sub
Private Sub Application_Background
fm.FCMDisconnect 'should be called from Application_Background
'LocManager.Stop
'LocManager.StopHeading
End Sub
Private Sub LocManager_HeadingChanged (MagneticHeading As Double, TrueHeading As Double)
If TrueHeading >= 0 Then
' lblHeading.Text = NumberFormat(TrueHeading, 1, 0) & Chr(176) & " (true north)"
Else
' lblHeading.Text = NumberFormat(MagneticHeading, 1, 0) & Chr(176) & " (magnetic)"
End If
End Sub
Sub LocManager_AllowCalibration As Boolean
Return
End Sub
Private Sub LocManager_LocationError
Log("Error: " & LastException.Description)
End Sub
Could someone explain, why Apple is not happy with my app?
I didn't understand this point:
******************
You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.
******************
Thanks in advance!