iOS LocationManager is not updating location (Titanium Appcelerator module) - ios

I've made Appcelerator Titanium Module for fetching device's rotaion and location. Source can be found on GitHub.
The problem is that it fetches only one cached location but device motion data is OK and it is refreshing.
I don't use delegate, I pull that data in my Titanium Javascript Code.
If I set "City Run" in Simulator -> Debug -> Location nothing happens. The same cached location is returning.
Pulling of location is OK because I tried with native app wich does this:
textView.text = [NSString stringWithFormat:#"%f %f\n%#",
locationManager.location.coordinate.longitude,
locationManager.location.coordinate.latitude,
textView.text];
And it is working in simulator and on device.
But the same code as you can see on GitHub is not working as Titanium module.
Any ideas?
EDIT:
I am looking at GeolocationModule src and I see nothing special there.
As I said, my code in my module has to work since it is working in native app. "Only" problem is that it is not updating location and it always returns me that cached location.

The answer is to put ENSURE_UI_THREAD at the top of function that starts location updating.

Related

I want to use DispatchQueue in Objective-C. This is a workaround for the warning I get in Flutter

I am developing an app in Flutter.
I am using the geolocator package and when I build my iOS app I get a warning.
The app launches successfully, but I am unable to get GPS information.
I did some research and it looks like the warning is displayed when using xcode14 and iOS16.
It seems that the best way to handle this is to run the app in parallel instead of running it in the main thread.
What I found is Swift code, so I would like to be able to run it in Objective-C as well.
WARNING message
This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the `-locationManagerDidChangeAuthorization:` callback and checking `authorizationStatus` first.
development environment
iOS16.2
Xcode14
geolocator7.7.1
iPhone SE2(Actual Device)
This warning did not appear when the emulator was used. The emulator is also able to acquire GPS information. All emulators are running in Android Studio.
It seems that Xcode14 is the problem.
Can you make the following code Objective-C?
It would be better to enclose it in DispatchQueue.global().async { }.
DispatchQueue.global().async {
//Process with warnings
}
reference
Main thread warning with CLLocationManager.locationServicesEnabled()
Thank you.

UnityAds in iOS using wrong game id, and not working

I am using UnityAds in my mobile game, to show a banner and a rewarded video.
In the editor and in Andorid works fine.
However for iOS it doesn't work, i took the logs and i noticed that for iOS is using my android gameid, this i have no idea where it comes from, i searched every file in my project, i never reference the android gameid, just the iOS one.
So it is clearing taking the id not from my initialization but from some sort of cache, anybody has an idea where is taking the gameid from? thanks
Btw
I am using Advertisement package from package manager.
You can open manually Project Folder\ProjectSettings\UnityConnectSettings.asset in text or code editor, then find
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_IosGameId: <---- THIS ONE
m_AndroidGameId:
m_GameIds: {}
m_GameId:
and edit it

$ngCordova BLE plugin is undefined on iOS

I am working on connecting my iOS 5c v9.3.2 to my arduino uno with the blefruit add on. I am working on an Ionic project with the most recent version of ionic and cordova installed. I tried installed ngCordova, and included the cordova-plugin-ble-central to my plugins. I injected $cordovaBLE as I saw a few other examples show, but it was just an empty object when I ran the following code within the controller: alert(JSON.stirngify($cordovaBLE)); I also tried that with ble but it did not show a message. I believe that ble is undefined and because of that, the $cordovaBLE could not properly create it's functions. Is anyone else having this issue or might be able to help?
I tried creating a new project in ionic and setting it up as I had above, and this time when I used the ble to call my functions and copied the code directly from it's readme.md, it worked. I was passing an object where I should have been passing a success callback.

appcelerator iOS application error with geolocation module

We are developing app for iOS and Android and we are using Ti.Gelocation to getCurrentPosition and then set the Region of the MapView of ti.map module.
The app is already on marketplace and downloaded, so we are developing an important upgrade with this new feature. We dont't have problem with Android platform, but with iOS version of the app we get a several error invoking Ti.Geolocation module
The error on iOS 9.x on iPad and iPhone (we have no test on iPod) is:
-[__NSCFString containsObject:] unrecognized selector sent to instance 0x1463d500 at GeoView.js (line xxxx)
This error happens with the project with it.vocami.vocamiapp app-id, in the test project (ap-id=it.vocami.vocamitest) that we use for research and test of new features, no error happens and all run good. When we add at every level of our code (in the first row too), for example, Ti.Geolocation.locationServiceEnabled, in the main vocamiapp project, we get the error.
We have tried all we could think but at the end, if we change the app-id, the code runs otherwise we get the error. We cannot change the app-id because we need to update our published app.
We are developing with AppceleratorStudio version 4.5.0.021602170281 and Ti SDK ver 5.2.0GA on Mac OS X 10.10.5.
I just recently was "hit" by the fact that when I made my app ready for Google Play I use a specific key/user to sign it with. That behaves differently from just running it locally on the phone.
I had to make sure that I had registered two certificates with Google's API in the developer console. It didn't give me exactly the message that you show - but wouldn't show the map with a location. And the way I read the location prior to showing it on the map led me in the wrong direction looking at permissions on Android first :-)
/John

xcode sample project "CurrentAddress": where does current location come from?

I am using Xcode version 4.5.1 and OS X version 10.8.2.
I downloaded the CurrentAddress sample project (ver 1.2) and when I run it the first time it prompts "'CurAddress' Would you like to use your current location", to which I say OK. I cannot figure out from where the code is getting the location that it ends up using, which is in or near San Francisco, lat 37.7858, long -122.406. I have looked all over the project and cannot see where these values are coming from. Thanks for any help.
this comes from CLLocationManager, which either will get that data from the GPS sensor in your iphone device, or from the GPS simulation built in in iPhone Simulator.
San Francisco is the default GPS simulation track, near Apples Headquarter.
If you are running in simulator, go to simulator debug menu -> Location -> you can set any location here. If I am correct, your CLLocationManager should pick the current location in simulator from here. In device, it should pick the current location, if the same is enabled.

Resources