iOS Facebook SDK 3.2图片发布w /描述打开图形

问题描述:

无论我尝试什么,我都无法将我的描述显示在Facebook上。我使用了调试器,并且生成的链接一切正常,URL填充了适当的数据。图片上传正常,但描述不存在。有什么我需要在Facebook设置为应用程序设置?iOS Facebook SDK 3.2图片发布w /描述打开图形

下面是相关代码:

- (id<FBPost>)outfitObjectForOutfit{ 

id<FBPost> result = (id<FBPost>)[FBGraphObject graphObject]; 

NSString *format = 
@"http://mysite.mobi/app/fbOpen.php?" 
@"og:title=%@&og:description=%%22%@%%22&" 
@"og:caption=%%22%@%%22&" 
@"og:image=http://mysite.mobi/images/transBlank.png&" 
@"body=%@"; 
result.url = [NSString stringWithFormat:format, 
       @"New Post Title",fldDescription.text,fldDescription.text,fldDescription.text]; 
return result; 
} 

这发布到FB的部分:

- (void)postOpenGraphActionWithPhotoURL:(NSString*)photoURL 
{ 

id<FBPost> outfitObject = [self outfitObjectForOutfit]; 

id<FBPostOutfit> action = 
(id<FBPostOutfit>)[FBGraphObject graphObject]; 

action.outfit=outfitObject; 

    if (photoURL) { 
    NSMutableDictionary *image = [[NSMutableDictionary alloc] init]; 
    [image setObject:photoURL forKey:@"url"]; 

    NSMutableArray *images = [[NSMutableArray alloc] init]; 
    [images addObject:image]; 

    action.image = images; 
} 
[FBSettings setLoggingBehavior:[NSSet 
           setWithObjects:FBLoggingBehaviorFBRequests, 
           FBLoggingBehaviorFBURLConnections, 
           nil]]; 
NSLog(@"%@",action); 
NSMutableDictionary *params = [NSMutableDictionary dictionary]; 
[params setObject:fldDescription.text forKey:@"message"]; 
[FBRequestConnection startForPostWithGraphPath:@"me/appnamespace:action" 
            graphObject:action 
          completionHandler: 
^(FBRequestConnection *connection, id result, NSError *error) { 
    NSString *alertText; 
    if (!error) { 
     alertText = [NSString stringWithFormat: 
         @"Posted Open Graph action, id: %@", 
         [result objectForKey:@"id"]]; 
    } else { 
     alertText = [NSString stringWithFormat: 
         @"error: domain = %@, code = %d", 
         error.domain, error.code]; 
     NSLog(@"%@",error); 
    } 
    [[[UIAlertView alloc] initWithTitle:@"Result" 
           message:alertText 
           delegate:nil 
         cancelButtonTitle:@"Thanks!" 
         otherButtonTitles:nil] 
     show]; 
} 
]; 
} 

我想通了,我的问题。我很困惑Facebook的例子(活动发布)和发布到用户的墙上。这是所有我不得不这样做,以得到它的工作:

NSMutableDictionary* params = [[NSMutableDictionary alloc] init]; 
[params setObject:fldDescription.text forKey:@"message"]; 
[params setObject:UIImagePNGRepresentation(userImage) forKey:@"picture"]; 

[FBRequestConnection startWithGraphPath:@"me/photos" 
          parameters:params 
          HTTPMethod:@"POST" 
         completionHandler:^(FBRequestConnection *connection, 
              id result, 
              NSError *error) 
{ 
    if (error) { 

     [[[UIAlertView alloc] initWithTitle:@"Result" 
            message:@"Sorry there was an error posting to Facebook." 
            delegate:nil 
          cancelButtonTitle:@"OK" 
          otherButtonTitles:nil] 
      show]; 
    } 
}]; 

我还要提到的是我不得不进入我的应用程序的opengraph设置和允许的用户信息和用户生成的照片。