我不明白這個問題似乎與我的應用程序。無法在iOS應用程序中輸出網址 - lastfm
我可以分析和輸出的JSON文件,使特定標籤填充了藝術家,專輯名稱,以及專輯的ID的名稱。
我唯一的問題是使網址出現在標籤的位置。
我仔細檢查過的文檔,LastFM等,包括樣本輸出,但它仍然不顯示特定專輯的URL。
這個特定部分的代碼是:
#import "MusicDetailsViewController.h"
#import "FilmSearchService.h"
@implementation MusicDetailsViewController
@synthesize imgAlbum;
@synthesize txtAlbumName;
@synthesize txtArtistName;
@synthesize urlOverview;
@synthesize txtUrl;
@synthesize movie;
-(void)viewWillAppear:(BOOL)animated {
if ([self movie] != nil){
[self setTitle:[[self movie] valueForKey:@"name"]];
;
[txtAlbumName setText:[[self movie] valueForKey:@"name"]];
[txtArtistName setText:[[[self movie] valueForKey:@"artist"] description]];
[txtUrl setText:[[self movie] valueForKey:@"id"]];
NSLog(@"value of url = %@", txtUrl);
[urlOverview setText:[[self movie] valueForKey:@"url"]];
}
}
@end
這是幹什麼,當我收到錯誤消息:
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<MusicDetailsViewController 0x71a84f0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key txtUrllink.' ***
你確定valueForKey @「id」是NSString的類。你可以添加這個日誌NSLog(@「%@」,NSStringFromClass([[[self movie] valueForKey:@「id」] class]));並看到它是NSString。 – Greg
這是錯誤消息做,當我接收:***終止應用程序由於未捕獲的異常「NSUnknownKeyException」,原因:「[的setValue:forUndefinedKey:]:這個類不是密鑰值編碼兼容的鍵txtUrllink。「 ***第一次拋出調用堆棧 –
user1156596
看到這個問題:[這個類不是關鍵值編碼兼容的關鍵](http://stackoverflow.com/questions/3088059/this-class-is-not-key-值鍵編碼兼容的鍵) –