0

嗨,我使用 facebook graph api 在 facebook 墙上发布图片。当我单击按钮时,我的图片成功发布在 Facebook 墙上,但我的应用程序崩溃并出现此错误thread I: EXE_BAD_ACCESS(code I,address=0*7473f52),这是按钮方法中的代码

 NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2];

    //create a UIImage (you could use the picture album or camera too)
    UIImage *picture = [UIImage imageNamed:@"maltese.jpg"];

    //create a FbGraphFile object insance and set the picture we wish to publish on it
    FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];

    //finally, set the FbGraphFileobject onto our variables dictionary....
    [variables setObject:graph_file forKey:@"file"];

    [variables setObject:@"this is a test message: postPictureButtonPressed" forKey:@"message"];

    //the fbGraph object is smart enough to recognize the binary image data inside the FbGraphFile
    //object and treat that is such.....
    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];
    NSLog(@"postPictureButtonPressed:  %@", fb_graph_response.htmlResponse);


    NSLog(@"Now log into Facebook and look at your profile & photo albums...");

请指导我如何解决这个问题,我更多的调试器在这一点上给我错误我正在使用断点

FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];

这是堆栈跟踪

libobjc.A.dylib`objc_retain:
0x149ed70:  pushl  %ebp
0x149ed71:  movl   %esp, %ebp
0x149ed73:  subl   $8, %esp
0x149ed76:  calll  0x149ed7b                 ; objc_retain + 11
0x149ed7b:  popl   %ecx
0x149ed7c:  movl   8(%ebp), %eax
0x149ed7f:  testl  %eax, %eax
0x149ed81:  je     0x149edb7                 ; objc_retain + 71
0x149ed83:  movl   (%eax), %edx
0x149ed85:  movl   16(%edx), %edx
0x149ed88:  andl   $-4, %edx
0x149ed8b:  testb  $2, 2(%edx)
0x149ed8f:  je     0x149eda5                 ; objc_retain + 53
0x149ed91:  movl   1002945(%ecx), %ecx
0x149ed97:  movl   %ecx, 4(%esp)
0x149ed9b:  movl   %eax, (%esp)
0x149ed9e:  calll  0x149e08c                 ; objc_msgSend
0x149eda3:  jmp    0x149edb9                 ; objc_retain + 73
0x149eda5:  movl   %eax, (%esp)
0x149eda8:  movl   $0, 4(%esp)
0x149edb0:  calll  0x14a08a0                 ; -[NSObject retain]
0x149edb5:  jmp    0x149edb9                 ; objc_retain + 73
0x149edb7:  xorl   %eax, %eax
0x149edb9:  addl   $8, %esp
0x149edbc:  popl   %ebp
0x149edbd:  ret    
4

1 回答 1

0

更改此行

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:3];

    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"me/photos" withPostVars:variables];

希望能帮助到你...

于 2013-01-11T11:50:41.663 回答