1

我正在尝试了解如何处理 iOS 6 中的权限/访问请求。到目前为止,我发现的所有内容都只是模糊地描述了这一点,而没有提供任何代码示例等。是否有任何好的资源/教程呢?

具体来说,我试图发现是否有办法以编程方式重新提示用户以允许访问地址簿等。或者只是关于如何将这些东西集成到应用程序中的一般信息。

4

1 回答 1

2

Under Address Book in the iOS 6 SDK Release Notes, it says:

Users are able to grant or deny access to contact data on a per-app basis. To request access to contact data, call the ABAddressBookRequestAccessWithCompletion function after calling the ABAddressBookCreateWithOptions function. The ABAddressBookRequestAccessWithCompletion function does not block the app while the user is being asked to grant or deny access. Until access has been granted, the ABAddressBookRef object will not contain any contacts, and any attempt to modify contacts fails with a kABOperationNotPermittedByUserError error. The user is prompted only the first time access is requested; any subsequent calls to ABAddressBookCreateWithOptions will use the existing permissions. The completion handler is called on an arbitrary queue. If the ABAddressBookRef object is used throughout the app, then all usage must be dispatched to the same queue to use ABAddressBookRef in a thread-safe manner.

Although this is only speaking for the Address Book, I'm sure it applies to Photos, Contacts, etc.

https://developer.apple.com/library/prerelease/ios/#releasenotes/General/RN-iOSSDK-6_0/_index.html#//apple_ref/doc/uid/TP40012166

于 2012-09-20T22:47:49.507 回答