简体   繁体   English

发出网络请求时,iOS中的权限警报

[英]Permission Alert in iOS when making networking request

When making a networking request using the ACAccount and SLRequest objects in iOS, an alert appears when the app runs that asks 当使用iOS中的ACAccount和SLRequest对象发出网络请求时,在应用运行时会出现一条警告消息,询问

X app would like access to Twitter accounts X应用想要访问Twitter帐户

with buttons for "Don't Allow" and "OK. 带有“不允许”和“确定”按钮。

Where does this alert get called from? 该警报从何处调用? What method/object is it associated with? 它与什么方法/对象相关联? Where can I modify this alert and can I modify it so the user can pick from accounts? 我在哪里可以修改此警报,也可以对其进行修改,以便用户可以从帐户中进行选择?

It's this method [ACAccountStore – requestAccessToAccountsWithType:options:completion:] that shows this alert. 此方法[ACAccountStore – requestAccessToAccountsWithType:options:completion:]显示此警报。 that's why there's a completion block, it is only called after the user taps one of the buttons, or on some errors. 这就是为什么有一个完成块的原因,只有在用户点击其中一个按钮或出现一些错误后才调用它。

The completion block gives you a pointer to an array of accounts if the user gives you permission, so maybe you could present another alert for him to choose from these accounts. 如果用户授予您权限,则完成框会为您提供一个指向一系列帐户的指针,因此也许您可以向他提出另一个警报,供他从这些帐户中选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM