Ralf
Ralf

Reputation: 1108

WatchKit: Getting the current Location with openParentApplication:reply:

After opening the Apple Watch App, I wake up the iPhone-App with openParentApplication:reply: to get the current location. As Apple stated here, you should avoid Core Location in the WatchKit extension.

But if I ask my parent application, I have to setup Required background modes in my info.plist for location updates and ask the user for requestAlwaysAuthorization.

Is this really necessary? Will this cause problems when I upload the app to the App Store? They take a deeper look when background modes are activated.

Thanks a lot for answers.

Upvotes: 0

Views: 979

Answers (1)

Stephen Johnson
Stephen Johnson

Reputation: 5121

Yes, you are required to have requestAlwaysAuthorization for location updates to work in any background context and openParentApplication is a background context and so is your WatchKit extension. When you request the background mode for core location you have to give a reason why you want get core location in the background. You could try saying that the reason is for Apple Watch (worded better of course). Also, Apple said you should avoid Core Location in a WatchKit extension, but they didn't outright say you couldn't do it (though we will have to wait until more apps are approved to know for sure). The reason they give for avoiding core location is that the user can't authorize core location in a watch app. In my own app I use Core Location in my WatchKit extension. If the user does an action that requires core location I first check to see if it is authorized. If it is not authorized I don't start core location, instead I show a message to the user that tells them how authorize core location in my iOS app.

Upvotes: 3

Related Questions