Unable to get location while loading all photo from photolibrary using ALAsserLibrary

115 Views Asked by At

I would like to load all photos from Photolibrary with their timestamp and location.

I am using this code to achieve this:

CLLocation *location = [asset valueForProperty:ALAssetPropertyLocation];// Get location here
NSDate *timeStamp = [asset valueForProperty:ALAssetPropertyDate];// Get timeStmap
NSLog(@"Picture location: %@ on Date: %@",location.description, timeStamp);

Here is Problems:

  1. I am able to get timestmap accurate. But problem with location, I am unable to get accurate location, while my location service is enabled.
  2. In iOS 7 for some photos it is returning location details but not accurate, always returning current location with current time stamp.
  3. In iOS 6.1 also not able to get location, timestmap is accurate but not location. And for most of the photos location data is nil.

Here is log for iOS 7

2014-01-02 11:56:38.231 TestApp[898:60b] Picture location: (null) on Date: 2013-09-30 10:36:10 +0000
2014-01-02 11:56:38.284 TestApp[898:60b] Picture location: (null) on Date: 2013-10-03 07:23:51 +0000
2014-01-02 11:56:38.432 TestApp[898:60b] Picture location: <+17.44866667,+78.38300000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:38 AM India Standard Time on Date: 2013-10-07 13:18:26 +0000
2014-01-02 11:56:38.552 TestApp[898:60b] Picture location: <+17.44850000,+78.38300000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:38 AM India Standard Time on Date: 2013-10-07 13:18:38 +0000
2014-01-02 11:56:38.664 TestApp[898:60b] Picture location: <+17.44850000,+78.38300000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:38 AM India Standard Time on Date: 2013-10-07 13:18:39 +0000
2014-01-02 11:56:38.701 TestApp[898:60b] Picture location: (null) on Date: 2013-10-09 05:36:12 +0000
2014-01-02 11:56:38.735 TestApp[898:60b] Picture location: (null) on Date: 2013-10-09 06:55:21 +0000
2014-01-02 11:56:38.860 TestApp[898:60b] Picture location: <+17.44866667,+78.38300000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:38 AM India Standard Time on Date: 2013-10-15 12:00:53 +0000
2014-01-02 11:56:38.895 TestApp[898:60b] Picture location: (null) on Date: 2013-10-15 12:01:18 +0000
2014-01-02 11:56:39.013 TestApp[898:60b] Picture location: <+17.44883333,+78.38300000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-10-21 09:57:25 +0000
2014-01-02 11:56:39.132 TestApp[898:60b] Picture location: <+17.44900000,+78.38283333> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-10-21 09:57:45 +0000
2014-01-02 11:56:39.163 TestApp[898:60b] Picture location: (null) on Date: 2013-10-31 09:17:45 +0000
2014-01-02 11:56:39.233 TestApp[898:60b] Picture location: (null) on Date: 2013-10-31 11:42:13 +0000
2014-01-02 11:56:39.350 TestApp[898:60b] Picture location: <+17.44887167,+78.38291167> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-11-14 10:07:26 +0000
2014-01-02 11:56:39.480 TestApp[898:60b] Picture location: <+17.44873333,+78.38298833> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-11-14 10:09:54 +0000
2014-01-02 11:56:39.519 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 04:56:20 +0000
2014-01-02 11:56:39.577 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 04:56:49 +0000
2014-01-02 11:56:39.607 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 05:01:16 +0000
2014-01-02 11:56:39.635 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 05:01:21 +0000
2014-01-02 11:56:39.700 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 05:01:30 +0000
2014-01-02 11:56:39.732 TestApp[898:60b] Picture location: (null) on Date: 2013-11-22 05:02:35 +0000
2014-01-02 11:56:39.848 TestApp[898:60b] Picture location: <+17.44944667,+78.38292000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-11-25 10:40:15 +0000
2014-01-02 11:56:39.964 TestApp[898:60b] Picture location: <+17.44930333,+78.38288000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:39 AM India Standard Time on Date: 2013-11-25 10:40:42 +0000
2014-01-02 11:56:40.080 TestApp[898:60b] Picture location: <+17.44957833,+78.38255333> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:40 AM India Standard Time on Date: 2013-11-26 10:20:52 +0000
2014-01-02 11:56:40.197 TestApp[898:60b] Picture location: <+17.44989500,+78.38241667> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:40 AM India Standard Time on Date: 2013-11-26 10:21:17 +0000
2014-01-02 11:56:40.231 TestApp[898:60b] Picture location: (null) on Date: 2013-11-26 12:44:59 +0000
2014-01-02 11:56:40.348 TestApp[898:60b] Picture location: <+17.44842000,+78.38305500> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:40 AM India Standard Time on Date: 2013-12-11 10:52:40 +0000
2014-01-02 11:56:40.465 TestApp[898:60b] Picture location: <+17.44820333,+78.38291167> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:40 AM India Standard Time on Date: 2013-12-11 10:53:59 +0000
2014-01-02 11:56:40.583 TestApp[898:60b] Picture location: <+17.44842167,+78.38308667> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/2/14, 11:56:40 AM India Standard Time on Date: 2013-12-11 10:54:25 +0000
0

There are 0 best solutions below