Get Location with IOS APP

Its posible with IOS app get the location?. I know with webapp but with IOS i no see the device location in the LIBRARY.

Yes it is possible through declares. It’s not going to be a few simple declares though, you are going to need to create a dynamic NSObject subclass as a delegate then use a CLLocationManager object created through declares to get the current location object. From there you will need a few more declares to parse the location structure into Xojo datatypes. It won’t be easy, but it is certainly possible.
Relevant reference docs from apple:

Thanks Jason, i going to try with your recommendation.

If anyone has managed to obtain the location and / or compass bearing as described above, is there any chance of posting a ‘skeleton’ app as an example? I’d be eternally grateful!

I would also be eternally grateful if someone could post any progress on this.

I have a project coming up for a client that requires camera and GPS access. Jason has already posted an excellent camera module, so now I just need the location stuff.

I’ve been looking at a couple competitor products that allow access to these things already, but would rather work in Xojo if possible as the learning curve will be so much smaller for me.

Give me a couple hours to finish what I’m working on now and I will see what I can do.

Can anyone help yet with an example of ‘declares’ that provide the location?

Sorry, something came up that I had to focus on instead. Let me see what I can do.

Thank you - you’re a scholar and a gentleman! :slight_smile:

Well thank you. Although I do not have good news to report. It seems that this cannot be accomplished in Xojo at this time. NSClassFromString for the CLLocationManager class returns nil. From what I can find in the documentation, CoreLocation must be statically linked at compile time for anything to work, and we cannot do that in Xojo at this time. Unfortunately it seems that you/we are out of luck. Xojo will have to provide the classes to access location services.

That’s a shame. Hopefully the facilities will grow as there are new releases. In the meantime, it’s back to trying to learn Swift I go. Ho hum. Still love Xojo for other stuff though!

Make sure you file a feature request if you still want location services added for iOS.

I was thinkink iOS for Xojo is useless without any location service…

Is this also the case with Gyro/Acceleration, Jason? Because I’m having trouble getting your declare-example to work, it returns zeros.

Hm, it seems you are right. It looks like several feature requests are in order.

I’ve added a request for Location Services here:


To be honest I was surprised that GPS and camera access were not standard features. To me these are the things that make the possibilities for innovation in mobile apps so great. I may have to look elsewhere for my current project, which is a great shame.

Jason King has posted a great camera access project using declares at

Yup I’ve taken a look and it’s great. My plan was to use this if we could get location services working. I was just expressing my surprised that these things weren’t seen as ‘must have’ features as I would have thought a lot of people would need them. Every other framework I’ve looked at had these in place from the word go.

I’m very surprised they weren’t included as well, especially when they can be implemented in declares in a short amount of time, I wouldn’t think it would be very hard to add them to the framework which doesn’t have to jump through the same hoops as using declares does. Even if they weren’t added to the framework but we were given the option of linking against the builtin frameworks to declare into them that would allow most of the shortcomings to be overcome through declares.

I noticed there was no request for camera support in Feedback. I just made one. <>

If you allow Exif support, the camera should automatically add the location information to pictures taken, as part of the framework.