Question

I am using JSON to populate a mapView with markers.

At method -(void)connectionDidFinishLoading:(NSURLConnection *)connection

the compiler is showing an alert:

Incompatible pointer to integer conversion sending 'void *' to parameter of type 'NSJSONReadingOptions' (aka 'enum NSJSONReadingOptions')

at lines

categorias_first = [NSJSONSerialization JSONObjectWithData:data_for_first_connection options:nil error:nil];
categorias_second = [NSJSONSerialization JSONObjectWithData:data_for_second_connection options:nil error:nil];
categorias_third = [NSJSONSerialization JSONObjectWithData:data_for_third_connection options:nil error:nil];

This is the whole method code:

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    //if data received network indicator not visible
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;

    if(connection==first_connection) {

        categorias_first = [NSJSONSerialization JSONObjectWithData:data_for_first_connection options:nil error:nil];

    }
    else if(connection==second_connection){

        categorias_second = [NSJSONSerialization JSONObjectWithData:data_for_second_connection options:nil error:nil];
    }
    else if(connection==third_connection){

        categorias_third = [NSJSONSerialization JSONObjectWithData:data_for_third_connection options:nil error:nil];
    }

}

Any help to avoid the warning is welcome.

Was it helpful?

Solution

nil treated as ((void*)0) and has pointer type, but NSJSONReadingOptions (as an enum) is a integer type.

replace options:nil by options:0

EX :

    categorias_first = [NSJSONSerialization JSONObjectWithData:data_for_first_connection options:0 error:nil];
     ........
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top