TPK Can't Be Displayed in the Latest SDK 10.2.3

1369
9
Jump to solution
04-28-2014 10:21 PM
ShiminCai
Occasional Contributor III
Hi,

After I migrated my app to the new SDK 10.2.3, my tile packages can no longer be displayed. What I got was just an empty white screen. However, when I rolled back to the SDK 10.2.2, everything is working fine. Any idea? All my tpks were built in 10.1 ArcGIS. Does the new SDK require tpks being built in 10.2 ArcGIS?

Thanks,

Shimin
0 Kudos
1 Solution

Accepted Solutions
StevenEnsing
New Contributor III
My problem was occuring with the .tpk being stored in the documents directory. I was accessing it using the method below (this worked in 10.2.1, but not in 10.2.3)
[AGSLocalTiledLayer localTiledLayerWithName:fileName]
 
When I changed this to
[AGSLocalTiledLayer localTiledLayerWithPath:filePath]
, I was once again able to view the local tpk.
So there's either a problem with the 'localTiledLayerWithName:' method, or I was using it wrong before, but it was still working.
Either way, I think that will likely solve the original poster's problem.

The full code That worked:
-(AGSLocalTiledLayer *)retrieveOfflineBasemap{     NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];          NSArray *files = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:rootPath error:nil];          AGSLocalTiledLayer *localBasemap;     for (NSString *file in files){         if ([file hasSuffix:@"basemap.tpk"]){              NSString *bmpPath = [rootPath stringByAppendingPathComponent:file];             localBasemap = [AGSLocalTiledLayer localTiledLayerWithPath:bmpPath];              break;         }     }     return localBasemap; }

View solution in original post

0 Kudos
9 Replies
NimeshJarecha
Esri Regular Contributor
Is it possible for you to share your tpk? Also, try creating a tpk from 10.2 and test.

Regards,
Nimesh
0 Kudos
ShiminCai
Occasional Contributor III
I created a tpk in 10.2.1 arcmap and it didn't work either in the 10.2.3 sdk. But both the 10.1 and 10.2.1 tpks can be displayed in the 10.2.2 sdk. Note that there is no coding involved at all...

How do I upload the tpks to esri? Both together is about 140 mb.

Thanks,

Shimin
0 Kudos
ShiminCai
Occasional Contributor III
Further, I tried the latest LocalTiledLayerSample and it is experiencing the exactly same problem with my tpks: unable to display the tpks in 10.2.3 and ok with 10.2.2...
0 Kudos
NimeshJarecha
Esri Regular Contributor
You can upload to dropbox.com, box.com or any other location and share the link in private message.

Regards,
Nimesh
0 Kudos
ShiminCai
Occasional Contributor III
Hi Nimesh,

Here is the dropbox link for the two tpks: https://www.dropbox.com/sh/kqbjlri7ie0jl79/sD_rRg0hqy . The tpks are in the spatial reference of 3308 GDA_1994_NSW_Lambert.

Thanks a lot for your help.

Shimin
0 Kudos
StevenEnsing
New Contributor III
I've been getting the same problem; I'm on the 10.2.3 SDK, but the basemap I'm using was generated using the Collector app (just for dev purposes). 
When I add the tpk, it just shows up black. Was working well on 10.2.1 SDK.
0 Kudos
DiveshGoyal
Esri Regular Contributor
Hi, Shimin -

Thanks for uploading your tpks. I was able to display the 1021 TPK both on the simulator and iPhone 5 device using the LocalTiledLayerSample.  All I did was add it to the sample's XCode project.

[ATTACH=CONFIG]33575[/ATTACH]

Can you confirm if it works for you in the sample?

If it doesn't work, I wonder if the tpk is somehow getting corrupted when being transferred over to the device. In the past I've seen this happen only with really large tpks (~500+ MB) when it is part of the XCode project and when Xcode tries to copy it over while installing the app on the device.

Have you tried adding the tpk to the apps's shared documents directory and loading it from there instead of including it in your project? I'm afraid we'll have to try a few variations and try to narrow down when this problem surfaces.

Also, do you get any errors reported by the AGSLocalTiledLayer when you try to intialize it with the tpk?


_
Divesh
0 Kudos
StevenEnsing
New Contributor III
My problem was occuring with the .tpk being stored in the documents directory. I was accessing it using the method below (this worked in 10.2.1, but not in 10.2.3)
[AGSLocalTiledLayer localTiledLayerWithName:fileName]
 
When I changed this to
[AGSLocalTiledLayer localTiledLayerWithPath:filePath]
, I was once again able to view the local tpk.
So there's either a problem with the 'localTiledLayerWithName:' method, or I was using it wrong before, but it was still working.
Either way, I think that will likely solve the original poster's problem.

The full code That worked:
-(AGSLocalTiledLayer *)retrieveOfflineBasemap{     NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];          NSArray *files = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:rootPath error:nil];          AGSLocalTiledLayer *localBasemap;     for (NSString *file in files){         if ([file hasSuffix:@"basemap.tpk"]){              NSString *bmpPath = [rootPath stringByAppendingPathComponent:file];             localBasemap = [AGSLocalTiledLayer localTiledLayerWithPath:bmpPath];              break;         }     }     return localBasemap; }
0 Kudos
ShiminCai
Occasional Contributor III
Yes the method "localTiledLayerWithPath:filePath" solved my problem and I agree with Steven that there might be a problem with the "localTiledLayerWithName:fileName" method. Thanks Steven.

A strange thing for ESRI to look into: I've been removing and reinstalling the 10.2.3 sdk for five times. At one time the method "localTiledLayerWithName" worked but other times it didn't. It might be an installer issue or a problem with the method. Thanks Divesh for looking into my problem.

Cheers,

Shimin
0 Kudos