Deprecated xcode 6.1.1


Hi everybody,

I’m new to objective C and I use Xcode 6.1.1 and iOS 8 so its a big trouble to convert the book code Xib > storyboard. I write the code in the didviewload area instead the xib init method
and here’s my problem :

I use

-(void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations

instead of the deprecated ToLocation/FromLocation method.

My code building running but no coordinate appears in the console.

Of course locationManager is well declared in the view controller.h

//  ViewController.m
//  WhereAmI
//  Created by Jérémie Lolieux on 08/01/2015.
//  Copyright (c) 2015 LOLIEUX. All rights reserved.

#import "ViewController.h"

@interface ViewController ()


@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    if (self) {
        //création du gérant de Géolocalisation
        locationManager = [[CLLocationManager alloc]init];
        //cette ligne déclenche un avertissement que nous ignorons pour le moment
        [locationManager setDelegate:self];
        //demandons la précision maximale
        //sans nous soucier du temps et de la consommation
        [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
        //Lançons la géolocalisation sur le champ
        [locationManager startUpdatingLocation];
        NSLog(@"is it read ?");

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
-(void)locationManager:(CLLocationManager *)manager
    didUpdateLocations:(NSArray *)locations
    NSLog(@"%@", [locations lastObject]);
-(void)locationManager:(CLLocationManager *)manager
      didFailWithError:(NSError *)error
    NSLog(@"failed : %@", error);


please can some one help me ?

By advance thanks a lot and excuse the french comments in the code

Bye and “I’m Charlie”



I find by Myself and I post the answer !

In iOs8 you need to set NSLocationWhenInUseUsageDescription as a KEY in your info.plst with the text you want in the pop up for user.

and add : [locationManager requestWhenInUseAuthorization]; in your code to popup the uialertview and access to the Data.