开发者

CLLocationManager didUpdateToLocation, bring values to a NSString to use elsewhere!

Using NSLog(@"%@",longi) outside this function crashes my application.... How can I use this NSLog outside the didUpdateToLocation function? Like in a IBAction function.

This example works great! But How to use this NSLogs outside this one?

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {


    longi = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.longitude];
    lati = [[NSString alloc开发者_JS百科] initWithFormat:@"%g", newLocation.coordinate.latitude];


    NSLog(@"%@",longi);
    NSLog(@"%@",lati);



}


You can store this values in NSUserDefaults and access them whenever needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜