mobileGetContactData to get users URL

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

mobileGetContactData to get users URL

Post by quailcreek » Thu Aug 31, 2017 4:22 am

Hi,
I'm using mobileGetContactData to gather a contacts info. I can get everything except the contacts website. I created some dummy contacts on my phone for testing so I know there is a website there. What am I doing wrong? Thanks in advance.

Code: Select all

put theData[contact]["URL"]["home"]["1"] into theHomeWebsite
mobileControlSet "Website","text", theHomeWebsite
I running LC 8.1.6
Tom
MacBook Pro OS 10.12.6

quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: mobileGetContactData to get users URL

Post by quailcreek » Sun Sep 03, 2017 7:44 pm

So is this the correct syntax? If so, it's not working.

Code: Select all

 put theData[contact]["URL"]["home"]["1"] into theHomeWebsite
Tom
MacBook Pro OS 10.12.6

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 835
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: mobileGetContactData to get users URL

Post by dave.kilroy » Fri Sep 08, 2017 8:19 pm

Tom I've never used mobileGetContactData but am guessing it's giving you an array of data which you're putting into 'theData' - if so then you can query this array to find out what keys it holds (at multiple levels) so you can be sure you're calling the right element of the array. For example the follow code (untested) should display the keys (at the top level) of the array

Code: Select all

put the keys of theData into tKeysTopLevel
answer tKeysTopLevel
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 835
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: mobileGetContactData to get users URL

Post by dave.kilroy » Fri Sep 08, 2017 8:27 pm

Although, looking at the mobileGetContactData in the dictionary, the structure of what is returned looks very different to what you posted (but maybe the dictionary is out of date - it has also been known to be wrong!)
"...this is not the code you are looking for..."

quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: mobileGetContactData to get users URL

Post by quailcreek » Fri Sep 08, 2017 10:29 pm

Hi Dave,
Thanks for the reply. I've attached a stack that shows what I'm doing. I even edited the contact in the sim to have a home website and still no joy. Everything gets pulled for the contact except the url/website data both in the iPhone sim and device. It fails on the Android sim at the point where I check if the data is an array. That's odd because the documentation says mobileGetContactData is supposed to work on both.
Pull data from contacts.livecode.zip
(4.96 KiB) Downloaded 11 times
Tom
MacBook Pro OS 10.12.6

quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: mobileGetContactData to get users URL

Post by quailcreek » Sun Sep 10, 2017 6:57 am

I figured out why it was failing on Android. I needed to check Read Contacts under Application Permissions.
Tom
MacBook Pro OS 10.12.6

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 835
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: mobileGetContactData to get users URL

Post by dave.kilroy » Sun Sep 10, 2017 12:18 pm

Tom I think you've found a bug (or bugs) in how mobileGetContactData() operates - testing it here [LC 8.1.7(rc1), OS X 10.12.6 iPhone 6s running 10.3] it gives buggy results - sometimes data returned from a contact found with mobilePickContact returns ok, sometimes I only get partial data (a bit like you not getting the url), and sometimes I get a hard crash - mobileGetContactData() crashes and I can't even get it report the result...

I didn't try it on Android - I suggest you go to quality.livecode.com and report what you've found (upload your little test stack), if you then add a link to the bug report here in this thread I'll add a comment to the bug report mentioning my findings

Regards

Dave
"...this is not the code you are looking for..."

quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: mobileGetContactData to get users URL

Post by quailcreek » Sun Sep 10, 2017 7:51 pm

Hi Dave,
Thanks for the feedback. I've reported bugs before so I know the procedure. :D I think the reason you're getting partial data is because, right now, I'm only checking for Home data. Maybe the "missing" information from your contact contains Work data.
Tom
MacBook Pro OS 10.12.6

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 835
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: mobileGetContactData to get users URL

Post by dave.kilroy » Sun Sep 10, 2017 8:35 pm

Hey Tom - BTW I tweaked your stack here and when looking at some of contacts on my device I can see that the array produced by mobileGetContactData() is missing some keys and data - and for at least two of my contacts the app crashes hard. In fact I made a new test contact right on the phone and mobileGetContactData() could only get some of it's data...

So definitely buggy :shock:
"...this is not the code you are looking for..."

quailcreek
Posts: 608
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: mobileGetContactData to get users URL

Post by quailcreek » Sun Sep 10, 2017 11:27 pm

Here's a link to the bug report.
http://quality.livecode.com/show_bug.cgi?id=20358
Tom
MacBook Pro OS 10.12.6

Post Reply

Return to “iOS Deployment”