2012-03-23 192 views
2

我即將構建一個應用程序,該應用程序使用由github Facebook iOS SDK提供的開源庫支持Facebook共享按鈕。- [__ NSCFDictionary JSONRepresentation]:無法識別的選擇器

我的問題是,當我按下按鈕的應用程序崩潰,並且我得到這個錯誤:

2012-03-23 19:46:25.820 iLoctest[5557:15803] -[__NSCFDictionary JSONRepresentation]: unrecognized selector sent to instance 0x80c7a60 
2012-03-23 19:46:25.826 iLoctest[5557:15803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary JSONRepresentation]: unrecognized selector sent to instance 0x80c7a60' 
*** First throw call stack: 
(0x12fd022 0x16e6cd6 0x12fecbd 0x1263ed0 0x1263cb2 0x477b 0x12fee99 0x33914e 0x3390e6 0x3dfade 0x3dffa7 0x3df266 0x35e3c0 0x35e5e6 0x344dc4 0x338634 0x1e2fef5 0x12d1195 0x1235ff2 0x12348da 0x1233d84 0x1233c9b 0x1e2e7d8 0x1e2e88a 0x336626 0x2acd 0x2a35 0x1) 
terminate called throwing an exception 

這是我的代碼:

- (IBAction)fBookButton:(id)sender { 
NSMutableArray * locArray = [NSMutableArray arrayWithObjects: countryText.text,townText.text,streetText.text,zipText.text, nil]; 

// Attachments 
NSMutableDictionary* attach = [NSMutableDictionary dictionary]; 
[attach setObject:@"iLoc" forKey:@"info"]; 

// Parameters 

NSMutableDictionary * params = [NSMutableDictionary dictionary]; 
[params setObject:facebookAPIKey forKey:@"API_Key"]; 
[params setObject:locArray forKey:@"locArray"]; 
[params setObject:[attach JSONRepresentation] forKey:@"attach"]; 


} 

我使用的Xcode 4.3與iOS 5.1 。

如果您有關於如何對xcode 4.x進行相同操作的教程或書籍,那也會有所幫助。

+0

任何幫助plz ==== – 2012-03-24 13:55:47

回答

1

您是否包含JSON framework?您在NSMutableDictionary實例上調用的JSONRepresentation方法未包含在新的Xcode項目中,您需要下載源代碼並將其包含在項目中。

相關問題