美文网首页
苹果审核-5. 1.5 LEGAL: PRIVACY - LOC

苹果审核-5. 1.5 LEGAL: PRIVACY - LOC

作者: 筱笑 | 来源:发表于2016-08-30 14:15 被阅读6645次

    1.被拒说明

    LEGAL: PRIVACY - LOCATION SERVICES
    Legal - 5.1.5

    Your app uses background location services but does not clarify the purpose of its use in the location modal alert as required in the iOS Human Interface Guidelines.
    We've attached screenshot(s) for your reference.

    Next Steps

    Please revise the NSLocationAlwaysUsageDescription value in the info.plist to specify the intended purpose of using the user's location while the app is in the background.

    Resources

    For additional information and instructions on configuring and presenting an alert, see the Accessing User Data section of the iOS Human Interface Guidelines and the Information Property List Key Reference.

    2.被拒原因
    没有描述需要定位的原因。

    3.解决方法
    在下图所示的位置填写需要定位的原因。

    官方.png

    在工程Info.plist文件中添加需要展示的信息,先添加两个字段NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription,如图所示:

    Info.png

    4.定位用户位置的代码
    引入头文件#import <CoreLocation/CoreLocation.h>
    添加代理CLLocationManagerDelegate

    • 创建定位管理器:
        CLLocationManager *_locationManager;
        // 初始化定位管理器
        _locationManager = [[CLLocationManager alloc] init];
        // 设置代理
        _locationManager.delegate = self;
        // 设置定位精确度到米
        _locationManager.desiredAccuracy = kCLLocationAccuracyBest;
        // 设置过滤器为无
        _locationManager.distanceFilter = kCLDistanceFilterNone;
        // 开始定位
        // 取得定位权限,有两个方法,取决于你的定位使用情况
        // 一个是requestAlwaysAuthorization,一个是requestWhenInUseAuthorization
        [_locationManager requestWhenInUseAuthorization];//这句话ios8以上版本使用。 使用期间访问位置
        [_locationManager startUpdatingLocation];
    
    • CLLocationManager代理
    -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
    {
        NSString * lng = [NSString stringWithFormat:@"%lf", newLocation.coordinate.longitude];//经度
        NSString * lat = [NSString stringWithFormat:@"%lf", newLocation.coordinate.latitude];//纬度
        NSTimeZone *sysZone = [NSTimeZone systemTimeZone];//系统时区
        //系统会一直更新数据,直到选择停止更新,因为我们只需要获得一次经纬度即可,所以获取之后就停止更新
        [_locationManager stopUpdatingLocation];
        NSLog(@"----lng = %@,lat = %@,syszone = %@",lng,lat,sysZone);
    }
    

    相关文章

      网友评论

          本文标题:苹果审核-5. 1.5 LEGAL: PRIVACY - LOC

          本文链接:https://www.haomeiwen.com/subject/rxwfettx.html