views:

30

answers:

1

I am trying to get picture locational information with this code:

NSArray* assetsA = [myAssetsProxy getAssets];
int assetIDX = 0;
int n = [assetsA count];
for(assetIDX = 0; assetIDX < n; assetIDX++)
{
    ALAsset* asset = [assetsA objectAtIndex:assetIDX];
    id value = [asset valueForProperty:ALAssetPropertyLocation];
    if ([value isKindOfClass:[CLLocation class]]) {
        CLLocation* l = (CLLocation*)value;
        NSLog(@"%@", value);

        float r = l.coordinate.longitude;
        if(r < 180 && r > -180)
        {
            NSLog("Huray!!!");
        }
    }
}

but "r" variable always contains nan(0x400000) The location services are enabled for my app. Where is the problem?

A: 

I'm having the exact same problem when I run my app on a device (location services are enabled). If I run it on the simulator everything works fine though.

ebergner