代码之家  ›  专栏  ›  技术社区  ›  Cyril Godefroy

尝试猜测ALAssetPropertyLocation是否有效

  •  1
  • Cyril Godefroy  · 技术社区  · 15 年前

    我正在使用我的新超能力从iOS4+上的资产库加载图像,并读取照片拍摄的位置。

    例如我有

    +/-0.00 m(速度-1.00 mps/航向-1.00)@11/11/10 19:32:41 Heure normale de l\u2019欧洲中央车站

    这当然违背了我的准则:

    CLLocation *loc = ((CLLocation*)[asset valueForProperty:ALAssetPropertyLocation]);
        CLLocationCoordinate2D gpsLocation = loc.coordinate;
        double acc = loc.horizontalAccuracy;
        NSLog(@"Accuracy:%f", acc);
        if(acc >0){
            detailItem.latitude = [NSNumber numberWithDouble:gpsLocation.latitude];
            detailItem.longitude = [NSNumber numberWithDouble:gpsLocation.longitude];
        }
        NSDate *time = loc.timestamp;
        if(time != nil){
            detailItem.latitude = [NSNumber numberWithDouble:gpsLocation.latitude];
            detailItem.longitude = [NSNumber numberWithDouble:gpsLocation.longitude];
        }
    

    我通常用准确度,但这里不是否定的。

    1 回复  |  直到 15 年前
        1
  •  1
  •   Cyril Godefroy    15 年前

    好的,找到了。注意:在CL中查找与CL相关的函数,您会发现cllocationcoordinate2是无效的。

    推荐文章