I was trying to load the data back from the tpk file.
This is what I what I wrote
let layer = AGSArcGISTiledLayer.init(tileCache: AGSTileCache(fileURL: URL(fileURLWithPath: Globals.documentsDirectory.path + "/" + file)))
It can render the map perfectly
However, when I try to load the legend info with the function fetchLegendInfo, the result is empty.
here's my code:
layer.fetchLegendInfos(completion: { (legends:[AGSLegendInfo]?, error:Error?)->Void in
print(legends)
})
the variable legends will always be "Optional([])"
Am I doing it correctly?
Also to make sure there's actually data in the tpk file, i open it up with hex editor, which gives me this

Which shows there's data in it, but somehow it's not getting it back correctly.