从上图可以看出,Accounts框架中最重要的3个类是ACAccountCredential类、ACAccount类和ACAccountStore类。后面我们着重介绍这3个类。 (readonly, nonatomic) BOOL accessGranted; @end 需要注意,这个类中的属性都是只读的,这也就是说,开发者不能够直接使用这个类进行对象的构建,需要借助ACAccountStore *accountStore = [[ACAccountStore alloc] init]; //通过操作对象 构建社交平台类型示例 这里采用的新浪微博 ACAccountType *accountType 一旦用户授权通过,可以使用如下方法获取到用户的社交平台账户信息: ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType 类解析 @interface ACAccountStore : NSObject //所有账户列表 @property (readonly, weak, NS_NONATOMIC_IOSONLY) NSArray
dispatch_get_main_queue(), ^{ }); }]; } - (void)requestAccessSocial:(NSString*)identifer{ ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *twAccountType = [accountStore accountTypeWithAccountTypeIdentifier
; 获取对应的权限: - (void)checkSocialAccountAuthorizationStatus:(NSString *)accountTypeIndentifier { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *socialAccount = [accountStore accountTypeWithAccountTypeIdentifier const ACAccountTypeIdentifierLinkedIn NS_AVAILABLE(NA, NA); 请求对应的权限: - (void)requestTwitterAccess { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier
; 获取对应的权限: - (void)checkSocialAccountAuthorizationStatus:(NSString *)accountTypeIndentifier { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *socialAccount = [accountStore accountTypeWithAccountTypeIdentifier const ACAccountTypeIdentifierLinkedIn NS_AVAILABLE(NA, NA); 请求对应的权限: - (void)requestTwitterAccess { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier