0
안녕하세요. 내 애플리케이션에 안녕하세요. Facebook
을 통해 내 애플리케이션을 공유 할 수 있습니다. 그래서 내 프로젝트에 Facebook framework
을 추가했으며 번들 ID를 내 Facebook
에 추가했으며 앱 ID를 얻었지만 문제는 내가이 앱을 공유 할 수 없음을 나타냅니다.facebook을 통한 앱 공유가 작동하지 않습니다.
An error occurred. Please try again later
내 자극기에 이와 같이 표시되는 이유는 무엇입니까? 내 장치에 Facebook App
이 작동하지만 정상적으로 작동하지 않는 경우 Facebook App
에 이와 같은 오류가 표시됩니다. 이 문제를 해결하는 방법을 알려주십시오.
- (IBAction)share:(id)sender {
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:@"url/"];
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present share dialog
[FBDialogs presentShareDialogWithLink:params.link
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Error publishing story: %@", error.description);
} else {
// Success
NSLog(@"result %@", results);
}
}];
// If the Facebook app is NOT installed and we can't present the share dialog
} else {
// FALLBACK: publish just a link using the Feed dialog
// Put together the dialog parameters
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My appname", @"name",
@"test share.", @"caption",
@"sample.", @"description",
@"myrul", @"link",
nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Error publishing story: %@", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User canceled.
NSLog(@"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"]) {
// User canceled.
NSLog(@"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
NSLog(@"result %@", result);
}
}
}
}];
}
}
- (NSDictionary*)parseURLParams:(NSString *)query {
NSArray *pairs = [query componentsSeparatedByString:@"&"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs) {
NSArray *kv = [pair componentsSeparatedByString:@"="];
NSString *val =
[kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
params[kv[0]] = val;
}
return params;
}
위의 코드를 사용하여이 문제를 해결하는 방법을 알려 주셨습니다.
감사합니다.
는 않습니다이 코드 중량 알려주십시오과 중량이있는 컨트롤러 SLComposeViewController 내가 이미 페이스 북 아이디 모든게하지만 아직되지 추가 한이 – user3819340
때문이다 woriking – user3819340
내 대답을 다시 확인하십시오. – iBhavin