我正在使用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...");
请指导我如何解决这个问题我更多thig调试器在这一点上给我错误我正在使用断点
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
答案 0 :(得分:0)
更改此行
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:3];
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"me/photos" withPostVars:variables];
希望它有所帮助...