小编Sla*_*uta的帖子

使用ARC iPhone在XCode 4.2中消失UILocation警报

警报显示为瞬间,或者在使用ARC的项目中启动应用程序时未显示(不使用ARC,一切正常).(我添加CoreLocation框架并将其导入项目).

我的代码:

#import <CoreLocation/CoreLocation.h>

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 

    CLLocationCoordinate2D coordinate;
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    NSLog(@"jestem po okienku ");

    if (locationManager.locationServicesEnabled == NO) 
    {
        coordinate.latitude = 0.0;
        coordinate.longitude = 0.0;
    }
    else
    {     
        locationManager.desiredAccuracy = kCLLocationAccuracyBest;
        [locationManager startUpdatingLocation];
        CLLocation *location = [locationManager location];
        if (!location) {
            coordinate.latitude = 0.0;
            coordinate.longitude = 0.0;
        }
        // Configure the new event with information from the location.
        coordinate = [location coordinate];
    }
    return YES; }
Run Code Online (Sandbox Code Playgroud)

iphone uialertview

4
推荐指数
1
解决办法
925
查看次数

标签 统计

iphone ×1

uialertview ×1