Thursday, October 13, 2011

Video: GPS and Compass in Delphi/FireMonkey for iOS


  1. Dear Anders,

    Very nice work on the iOS development.
    I've been reading your articles with greate interest.

    While watching your video about GPS on iOS, I noticed your altitude
    is also shown, but when I build and test the app on my phone.
    The altitude shows 0 ft

    Going over the build-log and the source I could not find the problem, a google search let me to a forum, where someone stated he had to call the delegate 3 or 4 times before the altitude was shown (this was not about your example)

    Do you have any idea's about the matter ?

    Thanks in advance,

  2. It takes a couple of iterations for the altitude to be shown. It may also be an issue of platform. I haven't looked, but maybe it only works on 3GS and 4? Maybe only with iOS 4+?

    When I run it, it takes several seconds for the altitude to get a fix. It actually took well over a minute right now.

    Just let the app run for two minutes and watch it.

  3. Hi Anders

    Thanks for the great work.

    Unfortunately I cannot run the FMX_GPS demo, it compiles in my windows virtual windows but in XCODE I get different errors:

    On iPhone 5.1 Simulator I get this :” Command / bin/sh failed with exit code 1.

    If I run this on my device then I get 9 issues:
    cp: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    cp: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rm: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rm: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rmdir: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rmdir: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rmdir: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory
    rmdir: /Users/navidjamshidi/Library/Developer/Xcode/DerivedData/FMX_GPS-asxadtzyoowpgbefxrguhnmabrgj/Build/Products/Release-iphoneos/ No such file or directory

    I appreciate your respond to this matter.

  4. These errors have nothing to do with the cause. It's probably missing the component PAS file. Make sure you add the component source code files to the project on the Xcode side.

  5. Hi Anders,

    Now that Delphi XE5 is shipping, I am assuming that the Free Pascal Wrapper is no longer necessary because of the additional control support in the product. Here is some code that I wrote (that doesn't use FPC) that will work on iOS and Android using the OrientationSensor. The only problem is that my code only works when the device is laying perfectly flat if it is tilted in anyway the compass is off. Can you tell me what I need to do to correct the compass for tilt?

    procedure TMainF.OrientationSensor1DataChanged(Sender: TObject);
    X,Y,d,Deg : Double;
    X := OrientationSensor1.Sensor.HeadingX;
    Y := OrientationSensor1.Sensor.HeadingY;
    d := ABS(X/Y);
    Deg := RadToDeg(ArcTan(d));
    XLbl.Text := 'X=' + FloatToStr(X);
    YLbl.Text := 'Y=' + FloatToStr(Y);
    dLbl.Text := 'd=' + FloatToStr(d);
    { adjust degree for quadrant }
    if (Y >= 0) and (X <= 0) then
    Deg := Deg
    else if (Y < 0) and (X <= 0) then
    Deg := 180 - Deg
    else if (Y 0) then
    Deg := 180 + Deg
    else if (Y >= 0) and (X > 0) then
    Deg := 360 - Deg;
    DegLbl.Text := 'Deg=' + FloatToStr(Deg);
    Compass.RotationAngle := -Deg; { display compass direction }

    Note: There is a property: OrientationSensor1.Sensor.MagHeading but on my device it always displays as "NAN"

  6. Its like you read through my head! A person to understand a lot approximately this particular, such as you wrote the actual e-book inside something like that. Personally i think which can be done with just a few Pct to be able to stress the content residence a bit, on the other hand in lieu of that will, that may be fantastic blog site. A terrific read. I'm going to unquestionably return to their office.

  7. Excellent post. I was checking continuously this weblog and I am inspired! Very helpful information particularly the last section :) I handle such info much. I was looking for this particular information for a very lengthy time. Thank you and best of luck.

  8. Good post. I became checking continuously this web site that i'm amazed! Invaluable info especially the continue sections :) My spouse and i handle similarly info a whole lot. I'm interested in this type of details for your really lengthy time. Thanks and connected with good luck.

  9. hi!,I really like your writing very much! proportion we keep in touch extra approximately your article on AOL? I need an expert in this area to solve my problem. May be that is you! Taking a look forward to see you.

  10. I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz respond as I'm looking to create my own blog and would like to find out where u got this from. thanks

  11. Аденома предстательной железы полная безвкусица

  12. Since the advent of more eco-fashions becoming mainstream, one area
    in the past few years that has been lacking is in swimwear.
    Naptimes at your child's daycare can be made sweeter and safer
    by choosing non-toxic, organic nap mats. Then, scoop the meat onto a plate lined
    several paper towels thick to soak up the grease and you
    have your own version of low-fat meat.

    my web page - replica michael kors

  13. It's a shame you don't have a donate button! I'd without a doubt
    donate to this brilliant blog! I guess for now i'll settle for book-marking and adding
    your RSS feed to mmy Google account. I look forward to brand new updates and will share this blog with my Facebookk group.
    Chat soon!

  14. Doctors say they can cause a host of vision problems as well.
    Ultimately, the Canada Goose ladies expedition parka
    is an excellent choice and will provide you with many winters of enjoyment, pleasure and envious admirers.

    If the project can be broken up into parts, especially
    if the work is heavy or awkward to move, you will have a much easier time getting the project into the classroom in separate pieces.

    Feel free to visit my homepage - replica michael kors

  15. ola galera eѕtе site vende peçаѕ ԁe iphone pela
    metade &#8574օ presso vejam ο νalor &#8574ο lcd d&#1086 iphone
    6 pluz 650 reais original
    Peçа dе reposiçãο рara &#1086 ѕеu IPHONE 6 &#5090LUS, essa tela traz
    a garantia &#8574е total compatibilidade сom ο ѕеu aparelho.

    Α substituiçã&#1086 desta tela, restabelece todas аѕ funçõeѕ
    ԁо touch e LCD (VIDRO/TOQUE Ε IMAGEM).

    Se ɑ sua tela quebrou, compre аgora &#6513 tenha &#11423 sеu aparelho no&#7456օ outra ѵez.

    Peça dе reposiçãօ &#1088ara о ѕеu IPHONE 6 РLUS, essa tela
    traz а garantia dе total
    compatibilidade com о ѕ&#6513u aparelho.

    &#5034 substituiçã&#11423 desta tela, restabelece todas aѕ funçõеs ɗο touch е LCD (VIDRO/TOQUE &#5036 IMAGEM).

    S&#6513 a sua tela quebrou, compre agora е tenha ߋ ѕeu aparelho noνօ outra ѵez.

  16. Your mode of telling the whole thing in this article is genuinely good,
    every one be able to simply know it, Thanks a lot.

  17. Ola galera еste site vende peçаѕ Ԁе iphone pela metade ԁօ presso vejam o &#7456alor &#8574օ lcd ɗ&#11423 iphone
    6 pluz 650 reais original estou еm sp posto noѕ correios em 30 minutos
    Peça dе reposiçãօ ρara ߋ ѕеu IPHONE 6 РLUS, essa tela
    traz а garantia dе total compatibilidade
    com ο seu aparelho.

    A substituiçãߋ desta tela, restabelece todas ɑѕ funçõеѕ ԁo

    Ѕе а sua tela quebrou, compre agora
    е tenha &#1086 ѕ&#6513u aparelho noνо outra ѵez.

    Peça dе reposiçãօ ρara &#11423
    ѕеu IPHONE 6 &#5090LUS, essa tela traz a garantia Ԁе total compatibilidade сom &#11423 ѕeu aparelho.

    Α substituiçãο desta tela, restabelece todas
    аѕ funçõ&#6513s ԁߋ

    Ѕе ɑ sua tela quebrou, compre agora &#6513 tenha o ѕеu aparelho noѵ&#11423 outra ѵez.

  18. We'ге a group of volunteers ɑnd ߋpening а neԝ scheme
    іn οur community. Yοur website offered սѕ աith valuable info tο
    ѡork οn. Yоu have &#8574one аn impressive job and
    &#1086ur entire community աill Ƅе thankful tο ү&#11423u.

    &#8559y web site iphone app

  19. For those who want further facts just follow this :.
    This is doing under no circumstances necessarily mean that unhealthy for grant deserted going to be the traditional standard gowns…
    the skirts having said all that float but take heart the stay away from the usually
    intended to learn more about flatter the are you Embroidery and Lace ;
    These 2 mainstays for instance bridal fashion never go out similar to favour and let's never forget beading.
    In other words, a nightgown is still sexy lingerie despite being long because of how it is designed and how the woman looks when wearing the gown.

    my website; cheap prada bags

  20. Hmm is anyone else experiencing problems with the pictures
    on this blog loading? I'm trying to find out if its a problem on my end or if it's the blog.

    Any feedback would be greatly appreciated.

  21. Hi there! Someone in my Facebook group shared this site
    with us so I came to give it a look. I'm definitely enjoying
    the information. I'm book-marking and will be
    tweeting this to my followers! Superb blog and fantastic style and design.

  22. In this way, you just have to copy from the use of plastic.
    Brand names, made tote bags are almost always elegant and refined finish of gold-plated zippers or crystal jewelry.
    Along the excellent products come the expert advices concerning the plastic products that are appropriate
    for the business requirements of clients.

    my homepage michael kors canada

  23. Hi there Dear, are you really visiting this web site regularly, if so afterward you will
    without doubt obtain good knowledge.

  24. Way cool! Some very valid points! I appreciate you
    writing this write-up and the rest of the site is alzo really good.

    Look into my web page :: online marketing

  25. Hel&#8572&#11423, i think thjat i ѕaw уοu visited my blkg thus і ϲame
    tο “return the favor”.ӏ'm attempting tߋ find
    thngs t&#1086 improve mү site!I suppose
    іtѕ &#1086k tߋ սsе a few οf
    уоur ideas!!

    &#8559ү ρage - CPCS Theory Test Answers

  26. Después de haber leído este pensé que era muy esclarecedor.
    Aprecio que pasar algún tiempo y esfuerzo y energía para poner
    esta información juntos.

    ¡Oh Dios mío!

    Escriba más, eso es todo lo que tengo que decir. Literalmente, parece como si te apoyaste en el vídeo para
    hacer su punto.

  27. เช่า ts3...

    "[...]The Hacker’s Corner » Blog Archive » Video: GPS and Compass in Delphi/FireMonkey for iOS[...]"...

  28. Wonderful website you have here but I was curious if
    you knew of any discussion boards that cover the same topics talked about here?
    I'd really like to be a part of community where I can get opinions
    from other experienced people that share the same interest.

    If you have any recommendations, please let me know.

  29. It's very trouble-free to find out any topic on web as compared to textbooks,
    as I found this post at thhis web site.

    Feel freee to viosit my web site; repair credit rating