简体   繁体   中英

my app crashing on posting picture on facebook wall

hi im posting picture on facebook wall using facebook graph api . 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

 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

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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