简体   繁体   English

我的应用程序在Facebook墙上张贴图片时崩溃

[英]my app crashing on posting picture on facebook wall

hi im posting picture on facebook wall using facebook graph api . 您好,我使用Facebook图形API在Facebook墙上张贴图片。 when i click on button then my picture successfully posted on facebook wall but my app crashes and getting this error thread I: EXE_BAD_ACCESS(code I,address=0*7473f52) and this is the code inside button method 当我单击按钮时,我的图片成功发布到了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...");

kindly guide me how can i fix this problem and i more thig debugger giving me error on this point i am using breakpoint 请指导我如何解决此问题,并且我在使用断点的更多thig调试器给了我错误

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

this is the stacktrace 这是堆栈跟踪

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    

Change this line 更改此行

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:3];

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

Hope it helps... 希望能帮助到你...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM