Note that there are some explanatory texts on larger screens.

plurals
  1. PO'NSInvalidArgumentException', reason: '-[NSNull objectAtIndex:]: unrecognized selector sent to instance
    primarykey
    data
    text
    <p>i am using corelocation framework it works fine but sometimes it gives exception like</p> <blockquote> <p>'NSInvalidArgumentException', reason: <code>-[NSNull objectAtIndex:]</code>: unrecognized selector sent to instance </p> </blockquote> <p>This is my code: </p> <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"didUpdateToLocation: %@", newLocation); currentLocation = newLocation; if (currentLocation != nil) { NSString *strLink1=[NSString stringWithFormat:@"http://ajax.googleapis.com/ajax/services/search/local?v=1.0&amp;q=restaurents&amp;rsz=8&amp;sll=%f,%f&amp;radius=1000&amp;output=json",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude]; NSURL *url1=[NSURL URLWithString:strLink1]; NSData *data1=[NSData dataWithContentsOfURL:url1]; NSError *err; response1=[NSJSONSerialization JSONObjectWithData:data1 options:kNilOptions error:&amp;err]; arrdata=[[NSMutableArray alloc]init]; for (int i=0; i&lt;=7; i++) { NSString *strTitle=[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"title"]; NSString *strPhone=[[[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"phoneNumbers"]objectAtIndex:0]valueForKey:@"number"]; NSString *strAdd1=[[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"addressLines"]objectAtIndex:0]; NSString *strAdd2=[[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"addressLines"]objectAtIndex:1]; NSString *strAdd=[NSString stringWithFormat:@"%@,%@",strAdd1,strAdd2]; NSString *strLat=[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"lat"]; NSString *strLng=[[[[response1 valueForKey:@"responseData"]valueForKey:@"results"]objectAtIndex:i ]valueForKey:@"lng"]; dictdata1=[[NSMutableDictionary alloc]initWithObjectsAndKeys:strTitle,@"0",strAdd,@"1",strLat,@"2",strLng,@"3",strPhone,@"4", nil]; [arrdata addObject:dictdata1]; } } [tblView reloadData]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *strCell=@"cellIdentifier"; UITableViewCell *cell=[tblView dequeueReusableCellWithIdentifier:strCell]; UILabel *lblTitle; UILabel *lblAdd; if (cell==nil) { cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strCell]; lblTitle=[[UILabel alloc]initWithFrame:CGRectMake(0,0,300, 50)]; lblAdd=[[UILabel alloc]initWithFrame:CGRectMake(0,20, 320, 50)]; [cell.contentView addSubview:lblTitle]; [cell.contentView addSubview:lblAdd]; } lblTitle.backgroundColor=[UIColor clearColor]; lblTitle.text=[[arrdata objectAtIndex:indexPath.row]valueForKey:@"0"]; lblAdd.backgroundColor=[UIColor clearColor]; lblAdd.text=[[arrdata objectAtIndex:indexPath.row]valueForKey:@"1"]; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload