ABAddressBookGetAuthorizationStatus in simulator a

2019-01-20 11:20发布

问题:

I am updating an app for iOS 6 Address Book authorization and have hit a problem in testing. The simulator always returns that authorization is granted. This means I do not see the dialog popup requesting permission and can therefore not test that code path. Ok, use a device instead... The problem there is the OS appears to remember my answer so only asks once. Deleting the app does not help. On reinstalling it has retained the permission setting from before, so again no popup.

Resetting the simulator does not help and if you go into the Privacy settings on the simulator no apps are listed as requesting permission to the Address Book.

The only option I have is use another iOS device that has never had our app installed on for each test. This cannot be how you are supposed to test this. Any ideas anyone?

Thanks

回答1:

Found it. From the device, Settings->General->Reset->Reset Location & Privacy. So you have to do that for each test