0

我正在尝试从数组中获取一些数据并将其打印在 Xcode 中的 UILabel 上,但我收到警告:

从“NSArray *”分配给“NSString *”的不兼容指针类型

这是我的代码:

NSError *myError = nil;
NSDictionary *res = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves  error:&myError];
NSArray *results =  [res objectForKey:@"current_observation"];
NSArray *cur = [results valueForKey:@"weather"];
NSArray *tmp = [results valueForKey:@"temp_c"];
NSLog(@"Current conditions: %@, %@º", cur, tmp);

temp.text = (@"%@", tmp);
4

1 回答 1

3

而不是这个:

temp.text = (@"%@", tmp);

用这个:

temp.text = [tmp componentsJoinedByString:@""];
于 2013-05-13T10:45:49.710 回答