vincentneo / CoreGPX

A library for parsing and creation of GPX location files. Purely Swift.
https://www.vincent-neo.com
MIT License
261 stars 56 forks source link

MetaData Nil #69

Closed jearle1974 closed 4 years ago

jearle1974 commented 4 years ago

After creating and saving a GPX file with MetaData and verifying via print that the file does have the MetaData Tags, upon opening the file and converting via

guard let gpx = GPXParser(withURL: curFile)?.parsedData() else { completion(false); return; } let rideType = gpx.metadata?.keyword

the rideType as well as any other MetaData show nil.

Do you have documentation on how to properly use the MetaData?

Thank you in advance. Jason

vincentneo commented 4 years ago

Hi @jearle1974 again,

Interesting encounter... I have tested with my personal private project and on my end, it seems like it seems to be working as expected?

Judging from your two lines, it seems like you are already 'properly' using the metadata.

So, a few questions to ask:

As for your #56/#63 issue, sorry for the delays, but you can expect it to be merged soon, once I double check and confirm its working, etc.

jearle1974 commented 4 years ago

yes the gpx.metadata itself is nil upon opening the file yes file was generated from CoreGPX It looks ok, after saving the file I ran the print root.gpx() and this was the result, I do not have any tracks or track segments as it was only a quick test inside without GPS. I will try adding a location file to see if I get same results.

<?xml version="1.0" encoding="UTF-8"?>

ATV

However after I open the file the metadata is nil as per the attached image

Screen Shot 2020-01-06 at 8 03 46 AM

jearle1974 commented 4 years ago

Even when adding location file and producing tracks and segments with my file I receive the same error. Any thoughts?

(Screenshot redacted)

vincentneo commented 4 years ago

I’ll scrutinised my code again tomorrow. Apologies for having buggy code in this project...

by the way, I have removed your second screenshot as it showed coordinates, and I thought, could violate your privacy, if you did this by accident.

jearle1974 commented 4 years ago

Ok, thanks for removing :)

I would not classify your code as buggy by no means, it is great! I just seem to be having this small issue. It could be on my side...lol

jearle1974 commented 4 years ago

I decided to try adding metadata info in Merlos iOS-Open-GPX-Tracker as well just to test. Upon reopening the file I did receive metadata as nil, same result as noted above.

vincentneo commented 4 years ago

Hi @jearle1974,

Can you try out #70? In my testings it appears to work fine. Thank you.

jearle1974 commented 4 years ago

Works perfect Vincent, thanks for the fix!

vincentneo commented 4 years ago

good to know! will merge #70!