0

Could someone tell me "How to detect launch app via MFi device on iPhone"?

Apple announced several major changes for a new Location Permission Flow on iOS 13.
(https://gimbal.com/ios-13-location-permissions/)
If want to get the GPS signal, the user need to select while in using or always.
And set up showsBackgroundLocationIndicator = YES, the app could get the GPS in the background.

It works well on the normal case(Launch with press the icon on the mobile screen).
But I figure out it could not receive the GPS if launch app via MFi device.
I also report it on the Apple bug report(https://feedbackassistant.apple.com/feedback/7537501)
I got a workaround but the first one is how to detect launch app via MFi device on iPhone.
By the way, I also check the argument of UIApplicationMain, but no use.
Please help or try to give some ideas about how to achieve this. Thanks!

Test Steps
1. First launch & user accept the location permission
2. Confirm the GPS could be used & check the setting page
3. Force close the app
4. Plug with the lighting and launch via MFi device

Yash Rathod
  • 141
  • 1
  • 7
Phineas Huang
  • 813
  • 7
  • 19

2 Answers2

0

Answer my final solution.

I figure out if the app launch via the MFi device, the initial flow will enter applicationDidEnterBackground and not run to applicationDidBecomeActive. So, I just add a flag to record that and detect the EAAccessory status.

Share for who guys have a same problem. Hope this could be helped.

Phineas Huang
  • 813
  • 7
  • 19
0

iOS 15 can use CLLocation's sourceInfo(CLLocationSourceInformation) to determine location information is from Xcode or MFI.

Gaoming
  • 1
  • 3