Ios7 在facebook上与facebook共享我的ios应用程序详细信息
我正在我的facebook应用程序上添加共享功能。例如,当选择“说”时,会有一个按钮用于在facebook上共享该“说”。单击此按钮时,我只能在我的facebook页面上看到共享的说,没有关于我的ios应用程序的任何信息。如何让每个人都知道这句话是通过我的ios应用程序共享的?请帮帮我 我可能会晚一点。希望这有帮助 你必须使用帐户框架和社交框架与你的应用程序名共享。 首先确保你在Facebook上正确设置了你的应用程序。然后你可以使用Facebook应用程序ID通过你的应用程序共享你的帖子 下面是一个示例代码,向您展示了如何将Accounts框架与Social框架结合使用:Ios7 在facebook上与facebook共享我的ios应用程序详细信息,ios7,social-framework,slcomposeviewcontroller,Ios7,Social Framework,Slcomposeviewcontroller,我正在我的facebook应用程序上添加共享功能。例如,当选择“说”时,会有一个按钮用于在facebook上共享该“说”。单击此按钮时,我只能在我的facebook页面上看到共享的说,没有关于我的ios应用程序的任何信息。如何让每个人都知道这句话是通过我的ios应用程序共享的?请帮帮我 我可能会晚一点。希望这有帮助 你必须使用帐户框架和社交框架与你的应用程序名共享。 首先确保你在Facebook上正确设置了你的应用程序。然后你可以使用Facebook应用程序ID通过你的应用程序共享你的帖子 下面
ACAccountType * facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
// At first, we only ask for the basic read permission
NSArray * permissions = @[@"email"];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"275485699289493", ACFacebookAppIdKey, permissions, ACFacebookPermissionsKey, ACFacebookAudienceOnlyMe, ACFacebookAudienceKey, nil];
NSArray *accounts = [self.accountStore accountsWithAccountType:facebookAccountType];
//it will always be the last object with single sign on
self.facebookAccount = [accounts lastObject];
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:dict completion:^(BOOL granted, NSError *error) {
if (granted && error == nil) {
/**
* The user granted us the basic read permission.
* Now we can ask for more permissions
**/
NSArray *readPermissions = @[ @"publish_actions"];
[dict setObject:readPermissions forKey: ACFacebookPermissionsKey];
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:dict completion:^(BOOL granted, NSError *error) {
if(granted && error == nil) {
NSDictionary *parameters = @{@"message": @"This Should Work Perfectly !! "};
NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"];
SLRequest *feedRequest = [SLRequest
requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:feedURL
parameters:parameters];
feedRequest.account = self.facebookAccount;
[feedRequest performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse, NSError *error)
{
// Handle response
}];
} else {
NSLog(@"error is: %@",[error description]);
}
}];
} else {
NSLog(@"error is: %@",[error description]);
}
}];
}