3

我收到一个奇怪的编译器警告。它说:

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];
}

任何想法如何解决这一问题?谢谢!

4

1 回答 1

29

只需替换options:niloptions:0.

nil最终定义为((void*)0)并具有指针类型,但NSJSONReadingOptions(作为枚举)是整数类型

于 2013-03-02T11:12:10.533 回答