1
我想弄清楚如何獲取MWphotobrowser從json文件獲取照片,照片標題,照片縮略圖等等外部服務器。MWphotobrowser - 從Json獲取圖像
在viewDidLoad中,我有這樣的代碼:
- (void)viewDidLoad {
NSURL *url = [NSURL URLWithString:@"https://s3.amazonaws.com/mobile-makers-lib/superheroes.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[super viewDidLoad];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError)
{
NSLog(@"Back from the web");
}];
NSLog(@"Just made the web call");
}
在CASE3 MWphotobrowser的Menu.m,我有以下代碼:
case 3: {
photo.caption = [self.result valueForKeyPath:@"name"];
NSArray * photoURLs = [self.result valueForKeyPath:@"avatar_url"];
NSString * imageURL = [photoURLs objectAtIndex:indexPath.row];
[photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:imageURL]]];
enableGrid = NO;
break;
}
櫃面你錯過了,JSON文件我使用是https://s3.amazonaws.com/mobile-makers-lib/superheroes.json
沒有我調整似乎使它的工作,任何想法如何解決這個問題?
的結果是什麼你進入self.result – 2014-09-06 05:54:13
其實你的結果來自[array {字典}]格式,那是我問 – 2014-09-06 05:56:33
是的。在Menu.h中,我有@property(nonatomic,strong)NSMutableDictionary *結果;錯誤? – HalesEnchanted 2014-09-06 06:11:17