联系使用权限请求iphone [英] Contact Usage permission request iphone

查看:25
本文介绍了联系使用权限请求iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用被苹果审核团队拒绝了.据他们说原因是

My app was rejected by the apple review team. According to them the reason is

17.1:应用程序不能在未获得用户事先许可并为用户提供访问权限的情况下传输有关用户的数据有关如何以及在何处使用数据的信息.具体来说,您的应用无需请求许可即可访问用户联系人第一"

但是,我在我的 info.plst 中使用了 **NSContactsUsageDescription** 键来指定在我的应用中使用联系人的原因.

But, I have used **NSContactsUsageDescription** key in my info.plst to specify the reason of using contacts in my app.

我还需要做什么才能获得许可?

What should I have to do additionally for get permission?

推荐答案

您必须询问用户您的应用程序是否可以访问您的地址簿.此功能在 iOS 6.0 及更高版本中实现.

You have to ask user whether your application can access your Address book. This feature is implemented in iOS 6.0 and above.

你可以试试这个代码片段:

You Can try this code Snippet:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

-viewWillAppear:

// Asking access of AddressBook
// if in iOS 6
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) 
{ 
    // Request authorization to Address Book
    addressBook_ = ABAddressBookCreateWithOptions(NULL, NULL);

    if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined)
    {
         ABAddressBookRequestAccessWithCompletion(addressBook_, ^(bool granted, CFErrorRef error)
                                                 {
                                                     if (granted == NO)
                                                     {
                                                         // Show an alert for no contact Access
                                                     }
                                                 });
    }
    else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized)
    {
        // The user has previously given access, good to go
    }
    else
    {
        // The user has previously denied access
        // Send an alert telling user to change privacy setting in settings app
    }
}
else // For iOS <= 5
{
    // just get the contacts directly
    addressBook_ = ABAddressBookCreate();
}

这篇关于联系使用权限请求iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆