Start a new topic

iOS create point on user Location just like on Android

iOS create point on user Location just like on Android

Hi guys thanks for resolving my previous threads but this time I will  really need your help.

My task is to launch Wikitude View. Then create POI at place where user is. At the center of compass.

Then user change POI location using arrows. Then location is saved.

This logic and reasoning  works fine on Android and Wikitude. On Android programmer is placing his values to Wikitude.

On iOS I have problem.

I am using Location Manager to get my Location . According to this answer on this thread  

Location Manager and Wikitude should receive the same values from location iOS API.

But the point I trying to place is never on the center. Looks like there is a difference between location values that Wikitude receives and I receive.

Question #1 Can I receive somehow the same values? How I can synchronize my values with Wikitude values.

Thoes screenshots show my best results.


Sometimes Wikitute has problems with calculating  distance from user using javaScript function "distanceToUser()". In one screenshot distance is calculate on another is not (undefined javaScript value).

Usually distance  is undefined.


Question #2 Why Wikitutde has problem with calculating distance from user. On Android there is no problem with that. Could be that altitude have something to do this? The point is below me.

I tried some crazy solutions to solve those problems.

Solution that didn't work #1: Use Wikitude only values.

Ok so I thought if LocationManager doesn't give right values then I will use Wikitude location values. Thanks to this thread I know how to do it:

There is just BIG problem. Wikitude values that I receive by using "urlWasInvoked" method are rounded up like this.

alt = 123.XXX , lat = 52.XXXX , long = 20.XXXX

At first I thought that JS is rounding up double values but I was wrong. It would be cool If I could receive from Wikitude more detailed data like from LocationManager. Like this:

alt = 123.XXXXXXX , lat = 52.XXXXXXXX , long = 20.XXXXXXXX

Anyway I tired creating POI from thoes values but application is working even worse. Beside I am saving those values for future use. Rounding up is not a option.

Question #3  Can I create POI on javaScript side then send location values without roudning up to iOS Objective-C.

Solution that didn't work #2: architectView.InjectLocationWith...

On Android problem doesn't exist because programmer is sending his values. 

Question #4: Can I do the same trick on iOS? Working with Wikitude base of on my values that receieve from LocationManager.

I tried using "injectLocationWith" method but this doesn't work. Wikitude is updating a value and problem repeats.

This technique work only if I use injectLocation and then pause/resume  Wikitude. If I stand still the new location point will be on center of the compass.

Sounds like hack that creates new problem only to solve one.

I need your help.

We already created such a app on Android. It works fine.

We without a doubt create 3 application using Android and 3 more application using iOS with Wikitude. Total six applications using Wikitude SDK.

Time is import aspect on this one.

If you want to ask me more question please do. If you want me to send our app to you just ask. This is another deathend on this iOS version of our app. 

One deadend was already solved by your team. My boss beliefs you can also solve this one. Once again I am out of ideas.


How I on iOS can create POI point at the center of the compass and then save detailed location values.

Can iOS work with the same logic that we use on Android or there is some other crazy solution to do this.

Hi Cezary,

Do you also called -setUseInjectedLocation: from the iOS SDK? You should be able to inject locations into the iOS SDK so that it behaves like the Android SDK.


Best regards


It's true now everything works better but still I have some weird problem. This is how compass acts when I inject values. Look like the point is moving because of altitude.

Since my altitude   never be accurate I made a decision that I will  ignore that value.

My co-worker that works on Android version told me to set "0 value" to altitude to Wikitude. 

Now there is no problem with centering point. .But the points are always at the  my feet.

I was confused. If a inject 0 altitude value to Wikitude and also add point with 0 altitude. Should this point  be in the middle of my view. According to my co-worker this logic should be correct.

Then I decided to set altitude of points and everything else to "170". Now of course points are in the sky. There is no problem with compass as long there is static altitude. 

BTW I still have a problem with  JavaScript function "distanceToUser()". Why Wikitude doesn't calculate that.

Then I discovered with JavaScript event "OnLocationChange" that Wikitude have different altitude values that I inject.

214.763 is not a "0" 

Looks like I inject my longitude, latitude and accuracy values correctly but altitude is still different from value that I inject.

Can I tell Wikitude to ignore altitude value. It doesn't matter which version of method of InjectLocationWith I use.

Right now I got just one idea to solve this issue. On JavaScript event "onLocationChange" I will update all points to this Wikitude altitude so all my points should be at the middle of my view (not at the bottom not in the sky).

I need you help again. 

I solved problem with weird behavior of altitude.

Without a doubt right now I am inserting my values but there are diffrent problems. If you don't respond to this thread I will create new one with the same question. I don't know how your ticket system works.

This is really important to me and my problems with Wikitude will be finally over. I still need to create two similar apps for iOS and I still didn't solve this issue.

Two questions:

1. Why distance form user is undefined. I need some suggestions this problem exist with InjcetLocation method  and just Wikitude values. The same HTML/JS code works correctly on Android.

2. No matter how much I try this time I can't create point at the center of compass. If this normal behavior for compass we as a developers can accept that but we need your own word.

Sometime Wikitude shows me that distance between me and the point is just 10 cm. What is happening here.

If Wikitude almost always can't count my distance between me and the point there is possibility that compass simply doesn't work correctly. 

Sorry for my English.

I am really close to the end. Please help me


1) distanctToUser can return undefined if the user location is not available at this time. See the AR.location reference for more information about this. Maybe you're injecting the location in ObjC after you've loaded the World? You should inject the location before you're about to load the World.

2. If you position a GeoLocation/GeoObject at the exact same location as the user location is, the marker can be in front, beneath or above you. If you inject a location without altitude, the marker should be eiter visible in front of you or is not visible at all.

If you still have problems with your World, you can send us your Xcode project and we have a look at it.


Best regards


Hi again. I have a bad news.

I will send to you my app again.

I still have issue with compass and also since iOS 7 update my code that solved problem with Wikitude that doesn't worked on second try - stopped working.

Points can't be created on second try.

This code was weird and according to you not needed.Here is our conversation about that

I won't create another thread for that I will just send your my code. I hope my two issues will be solved.

About compass problem here is how I set inject method.

This how I insert my location and after that load the world.

Then I inserting my point with this location.

I need your help again. Please help me. 

If you have questions about the code please ask.

Andreas I made a mistake there is no bug with using Wikitude on sencond try. 

Still I don't know what I am doing wrong with injectLocation.

Did you receive my code.

Please just respond me.


There is a problem with sending email to you.

Here is link to my problem:. I can't waste anymore time.

Hi Cezary,

please send me either mails OR write forums posts. It's hard to follow your requests if you write both with different subjects!

I responded to your mails to make sure we can help you as soon as posible.

Best regards

Login or Signup to post a comment