我收到一个奇怪的编译器警告。它说:
Incompatible pointer to integer conversion sending 'void *' to parameter of type
'NSJSONReadingOptions' (aka 'enum NSJSONReadingOptions')
这是它所在的块:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//Incompatible pointer to integer conversion sending 'void *' to parameter of type
'NSJSONReadingOptions' (aka 'enum NSJSONReadingOptions')
news = [NSJSONSerialization JSONObjectWithData:data options:nil error:nil];
[mainTableView reloadData];
}
任何想法如何解决这一问题?谢谢!
最佳答案
只需将options:nil
替换为options:0
即可。nil
最终定义为((void*)0)
,具有指针类型,但是NSJSONReadingOptions
(作为枚举)是整数类型。