Accessing iOS contacts not working even with the sample plugin code

i am trying to implement the Accessing iOS contacts using the https://coronalabs.com/blog/2013/08/13/access-to-ios-contacts/

and i am getting an err The Second argument to native.showPopup(addressbook) must be a tables

even though i am using the exact methods .

so i tried to check with a sample code here

https://github.com/coronalabs/plugins-sample-native-popup-addressbook

and this time the address book didn’t show and instead it just show a white screen ( nothing changed )

 

what messages are in your console log?

Rob

With ios9 you’ve got to ask permission to access ios contacts.

Danny fixed the issue a couple months ago.  It works like this.

[lua]

  1.    local function loadAddressBook()
  2.        local PermissionStatus = native.showPopup(“addressbook”, {option = “getPermission”})
  3.         local function checkAuthorization()
  4.            – print(“checkAuthorization is called”)
  5.             
  6.             --alert is displayed if Permission is Denied or Restricted
  7.             local function removePermissionAlert(event)
  8.                 if “clicked” == event.action then
  9.                     i = event.index
  10.                     if 1 == i then   
  11.                       --dismiss the alert  
  12.                        – audio.play(EnterButtonSound)
  13.                         
  14.                     elseif 2 == i then     
  15.                     else
  16.                     end
  17.                 end
  18.                 return true
  19.             end
  20.             
  21.             if PermissionStatus == “authorized” then
  22.                 print("*****Contact Book Permission authorized")
  23.                 – use your existing params and callback function
  24.                 native.showPopup( “addressbook”, pickContactOptions )
  25.                 
  26.             elseif PermissionStatus == “denied” then
  27.                 native.showAlert(“Authorization Denied!”, “To allow Authorization, Go to Settings > Privacy > Contacts > Select YourAppName”, {“OK”}, removePermissionAlert)
  28.            --do something
  29.                 
  30.             elseif PermissionStatus == “requestPermission” then
  31.               --if permission is asked for, call the function again to see the requested result
  32.             checkAuthorization()
  33.                 
  34.             elseif PermissionStatus == “restricted” then
  35.                 native.showAlert(“Authorization Restricted!”, “Access to the users Contacts is restricted due to parental settings”, {“OK”}, removePermissionAlert)
  36.                – do something since permission restricted
  37.                 
  38.             else print(“PermissionStatus ==”, PermissionStatus)
  39.                
  40.             end
  41.         end
  42.         
  43.         print(“Flag1 PermissionStatus ==”,PermissionStatus)
  44.         
  45.         checkAuthorization()
  46.         
  47.     end
  48. [/lua]

here’s the link.

https://forums.coronalabs.com/topic/60012-addressbook-plugin-crash-on-ios-9/

Nail

Hi Rob . i managed to make it work asking first for permission to access the contacts

but i am not yet able to get the data from the filter .

i want to copy the mobile Number so i can use it later

here is my code

 

local function ListContacts( event ) native.showPopup("addressbook", { option = "getPermission", option = "pickContact", hideDetails = true, --performDefaultAction = true, filter = {"firstName"}, listener = onPopupDismiss }) end local function onPopupDismiss( event ) data1=event.data pasteboard.copy( "string",data1 ) end

till now i am not able to get the event.data . i am trying here the firstName to check if i can get that data or not

btw in iphone i can see filed Mobile . but i couldnot find that field on the option parm in corona docs . i found only phonemobile but i dont think they are the same .

i will keep trying to get the data and will tell you later
 

Thanks Portal5B ( i  were replying same time as you )

yes it was about th permission . but i still face main issue getting filtered data .

sobh…here’s my listener, give it a try and you will see what is contained in event.data. 

It looks for “custom” labels for email and phone so they don’t get dropped when importing.

It also looks for Zip Codes, they are now in caps.  homeZIP for ex.

[lua]

   local function onComplete( event )
        print("")
        print("")
        print(“onComplete(event) / import Contact”)
        print( “*********event.name:”, event.name );
        print( “*********event.type:”, event.type );
        
        – event.data is either a table or nil depending on the option chosen
        print ( “***********event.data:”, event.data );
        
        print("********** event.data.note == “, event.data.notes)
        print(”********** event.data.lastName == “, event.data.lastName)
        
        local firstName, lastName = “”, “”
        
        – If there is event.data print it’s key/value pairs
        if event.data then
            
            if D then  --create table to store Contact Info Data
                D = nil
                D = {}
            else
                D = {}
            end
            
            print( “********event.data: {” );
            
            for k, v in pairs( event.data ) do
                local kk, vv = k, v
                
                if type( v ) == “note” then
                    vv = “note”
                    print(”***** vv = note ==", vv)
                    
                end
                
                if type( v ) == “table” then
                    vv = “table”
                    print("****** table FOUND table == “, vv)
                    print(”****** table key == “, kk)
                end
                
                if type( v ) == “userdata” then
                    vv = “userdata”
                    print(”******* userData == “, userData)
                end
                
                if “notes” == k then
                    print(”********* notes == “, notes)
                    – else print (”******* NO notes")
                end
                
                if “note” == k then
                    print("********* note == “, note)
                    –  else print (”******* NO note")
                end
                
                – Print the picture table
                if “picture” == k then
                    for a, b in pairs( v ) do
                        print( a, b )
                        --PhotoFileName
                        if a == “fileName” then
                            D.fileName = b
                            print(">>>>>>>>>!!! Picture Key == “…a…”  fileName == “…b)
                        end
                    end
                end
                
                --textBox.text = textBox.text … " " … kk … “:  " … vv … “\n”
                
                --displays each Key/Value pair in Table
                --This will show “custom” labels for email and cell phone
                print( k , “:” , v );
                
                – Set the first name
                if “string” == type( v ) then
                    
                    – New Code to find Email Addresses and add “Email” to end of Key string
                    local EmailFlag1 = string.find(v, “@”)
                    local EmailFlag2 = string.find(v, “.”)
                    
                    print(“EmailFlag1 == “, EmailFlag1)
                    
                    if EmailFlag1 ~= nil and EmailFlag2 ~= nil then
                        print(“Email Address Found!!!”)
                        
                        k = “”…k…“Email?”
                        
                        D[””…k…””] = v
                        
                        print(“emailKey : k == “…k…””)
                        –  print(“D.k == “, D.k)
                        – print(“D[””…k…”"] == " …D[""…k…""]…")
                    end
                    --End New Code
                    
                    --New Code to find phone numbers
                    local PhoneFlag2 = string.find(v, “%(%d%d%d%)”)
                    
                    
                    print(“PhoneFlag2 == “, PhoneFlag2)
                    print(“PhoneFlag2 k == “,k)
                    print(“PhoneFlag2 v == “,v)
                    
                    if PhoneFlag2 ~= nil then
                        print(“PhoneNumber Found!!!”)
                        
                        k = “”…k…“PhoneNumber?”
                        
                        D[””…k…””] = v
                        
                        print(“k == “…k…””)
                        –  print(“D.k == “, D.k)
                        – print(“D[””…k…””] == " …D[”"…k…""]…")
                    end
                    
                    – End Find Phone Number Code
                    
                    --Names
                    
                    if k == “firstName” then
                        D.firstName = v
                        
                        – Set the second name
                    elseif k == “lastName” then
                        print("**********>>>>>>>>>>>>")
                        print("********** k == ‘lastName’ == “, k)
                        D.lastName = v
                        
                    elseif k == “middleName” then
                        D.middleName = v
                        
                    elseif k == “prefix” then
                        D.prefix = v
                        
                    elseif k == “suffix” then
                        D.suffix = v
                        
                    elseif k == “organization” then
                        D.organization = v
                        
                    elseif k == “jobTitle” then
                        D.jobTitle = v
                        
                    elseif k == “birthday” then
                        D.birthday = v  
                        
                    elseif k == “nickName” then
                        D.nickName = v   
                        
                    elseif k == “anniversary” then
                        D.anniversary = v
                        
                    --[[]    --PhotoFileName
                    elseif k == “fileName” then
                        print(”************* fileName == “…k…” / v == “…v)
                        D.fileName = v --]]
                        
                        --Other
                        
                    elseif k == “phoneticFirstName” then
                        D.phoneticFirstName = v
                        
                    elseif k == “phoneticMiddleName” then
                        D.phoneticMiddleName = v
                        
                    elseif k == “phoneticLastName” then
                        D.phoneticLastName = v
                        
                        --Emails
                        
                    elseif k == “homeEmail” then
                        D.homeEmail = v
                        
                        print(”*** homeEmail FOUND!")
                        print(“D.homeEmail == “, D.homeEmail)
                        
                    elseif k == “workEmail” then
                        D.workEmail = v
                        
                    elseif k == “email” then
                        D.email = v
                        print(”…email found!”)
                        print("…D.email == “, D.email)
                        
                        --Phone
                        
                    elseif k == “phoneHome” then
                        D.phoneHome = v  
                        
                    elseif k == “phoneWork” then
                        D.phoneWork = v   
                        
                    elseif k == “phoneIphone” then
                        D.phoneIphone = v  
                        
                    elseif k == “phoneMobile” then
                        D.phoneMobile = v   
                        
                    elseif k == “phoneMain” then
                        D.phoneMain = v
                        
                    elseif k == “note” then
                        D.notes = v
                        print(”******* note Found! note == “, D.notes)
                        
                    elseif k == “notes” then
                        D.notes = v
                        print(”******* notes Found! notes == “, D.notes)
                        
                        --fax
                        
                    elseif k == “faxHome” then
                        D.faxHome = v   
                        
                    elseif k == “faxWork” then
                        D.faxWork = v  
                        
                    elseif k == “faxOther” then
                        D.faxOther = v   
                        
                        --pager
                        
                    elseif k == “pager” then
                        D.pager = v  
                        
                        --URLS
                        
                    elseif k == “homePageUrl” then
                        D.homePageUrl = v   
                        
                    elseif k == “workUrl” then
                        D.workUrl = v  
                        
                    elseif k == “homeUrl” then
                        D.homeUrl = v  
                        
                        --address
                        
                    elseif k == “homeStreet” then
                        D.homeStreet = v   
                        
                    elseif k == “homeCity” then
                        D.homeCity = v  
                        
                    elseif k == “homeState” then
                        D.homeState = v
                        
                    elseif k == “homeZIP” then
                        D.homeZip = v   
                        
                    elseif k == “homeCountry” then
                        D.homeCountry = v  
                        
                    elseif k == “workStreet” then
                        D.workStreet = v
                        
                    elseif k == “workCity” then
                        D.workCity = v  
                        
                    elseif k == “workState” then
                        D.workState = v
                        
                    elseif k == “workZIP” then
                        D.workZip = v  
                        
                    elseif k == “workCountry” then
                        D.workCountry = v
                        
                    elseif k == “otherStreet” then
                        D.otherStreet = v
                        
                    elseif k == “otherCity” then
                        D.otherCity = v
                        
                    elseif k == “otherState” then
                        D.otherState = v
                        
                    elseif k == “otherZIP” then
                        D.otherZip = v  
                        
                    elseif k == “otherCountry” then
                        D.otherCountry = v
                        
                    elseif k == “otherStreet1” then
                        D.otherStreet1 = v
                        
                    elseif k == “otherCity1” then
                        D.otherCity1 = v
                        
                    elseif k == “otherState1” then
                        D.otherState1 = v
                        
                    elseif k == “otherZip1” then
                        D.otherZip1 = v  
                        
                    elseif k == “otherCountry1” then
                        D.otherCountry1 = v
                        
                    elseif k == “otherStreet2” then
                        D.otherStreet2 = v
                        
                    elseif k == “otherCity2” then
                        D.otherCity2 = v  
                        
                    elseif k == “otherState2” then
                        D.otherState2 = v
                        
                    elseif k == “otherZIP2” then
                        D.otherZip2 = v  
                        
                    elseif k == “otherCountry2” then
                        D.otherCountry2 = v    
                        
                    elseif k == “otherStreet3” then
                        D.otherStreet3 = v
                        
                    elseif k == “otherCity3” then
                        D.otherCity3 = v   
                        
                    elseif k == “otherState3” then
                        D.otherState3 = v
                        
                    elseif k == “otherZIP3” then
                        D.otherZip3 = v  
                        
                    elseif k == “otherCountry3” then
                        D.otherCountry3 = v    
                        
                    elseif k == “otherStreet4” then
                        D.otherStreet4 = v
                        
                    elseif k == “otherCity4” then
                        D.otherCity4 = v  
                        
                    elseif k == “otherState4” then
                        D.otherState4 = v
                        
                    elseif k == “otherZIP4” then
                        D.otherZip4 = v  
                        
                    elseif k == “otherCountry4” then
                        D.otherCountry4 = v     
                        --People
                        
                    elseif k == “father” then
                        D.father = v  
                        
                    elseif k == “mother” then
                        D.mother = v
                        
                    elseif k == “parent” then
                        D.parent = v  
                        
                    elseif k == “brother” then
                        D.brother = v
                        
                    elseif k == “sister” then
                        D.sister = v  
                        
                    elseif k == “child” then
                        D.child = v
                        
                    elseif k == “friend” then
                        D.friend = v
                        
                    elseif k == “spouse” then
                        D.spouse = v  
                        
                    elseif k == “partner” then
                        D.partner = v
                        
                    elseif k == “assistant” then
                        D.assistant = v
                        
                    elseif k == “manager” then
                        D.manager = v  
                        
                        --Social
                        
                    elseif k == “socialFacebook” then
                        D.socialFacebook = v
                        
                    elseif k == “socialTwitter” then
                        D.socialTwitter = v
                        
                    elseif k == “socialGameCenter” then
                        D.socialGameCenter = v  
                        
                    elseif k == “socialFlickr” then
                        D.socialFlickr = v
                        
                    elseif k == “socialLinkedIn” then
                        D.socialLinkedIn = v  
                        
                    elseif k == “socialMyspace” then
                        D.socialMyspace = v
                        
                    elseif k == “socialSinaWeibo” then
                        D.socialSinaWeibo = v
                        
                    elseif k == “instantMessagingFacebook” then
                        D.instantMessagingFacebook = v  
                        
                    elseif k == “instantMessagingAim” then
                        D.instantMessagingAim = v
                        
                    elseif k == “instantMessagingGaduGadu” then
                        D.instantMessagingGaduGadu = v  
                        
                    elseif k == “instantMessagingGoogleTalk” then
                        D.instantMessagingGoogleTalk = v
                        
                    elseif k == “instantMessagingICQ” then
                        D.instantMessagingICQ = v  
                        
                    elseif k == “linstantMessagingJabber” then
                        D.instantMessagingJabber = v
                        
                    elseif k == “instantMessagingMSN” then
                        D.instantMessagingMSN = v  
                        
                    elseif k == “instantMessagingQQ” then
                        D.instantMessagingQQ = v
                        
                    elseif k == “instantMessagingSkype” then
                        D.instantMessagingSkype = v  
                        
                    elseif k == “instantMessagingYahoo” then
                        D.instantMessagingYahoo = v
                        
                    else
                    end
                    textBox.text = textBox.text … " " … kk … “:  " … vv … “\n”
                end
            end    
            
            – Set the contacts name
            – contactName.text = “Selected Contact:\n " … D.firstName … " " … D.lastName
            
            local Name = “Selected Contact: \n”
            
            if D.prefix then
                if D.prefix ~= “” then
                    Name = “”…Name…””…D.prefix  
                end
            end
            
            if D.firstName then
                if D.firstName ~= “” then
                    Name = Name…” “…D.firstName
                end
            end
            
            if D.middleName then
                if D.middleName ~= “” then
                    Name = Name…” “…D.middleName
                end
            end
            
            if D.lastName then
                if D.lastName ~= “” then
                    Name = Name…” “…D.lastName
                end
            end
            
            if D.suffix then
                if D.suffix ~= “” then
                    Name = Name…” “…D.suffix
                end
            end
            
            – contactName.text = contactName.text…”\n\n"
            
            --contactName.y = 85
            
            if contactName then
                display.remove(contactName)
                contactName = nil
            end
            
            contactName = display.newText( Name, 10, 65, native.systemFontBold, 16 )
            
            contactName:setReferencePoint(display.TopLeftReferencePoint)
            contactName:setFillColor( 0, 0, 0 )
            PickContactGroup:insert(contactName)
            
            print( “}” );
            print("…D.homeEmail == ", D.homeEmail)
        end        
    end
  

[/lua]

Hope this helps.

Nail

I should have told you, my listener adds a suffix to emails and phone number keys so I can find them when I parse the table later where I remove then remove the suffixs.

I was frustrated I couldn’t get custom key’s, the workaround seems to work.

Nail

Thanks Nail, i will give it a try

what messages are in your console log?

Rob

With ios9 you’ve got to ask permission to access ios contacts.

Danny fixed the issue a couple months ago.  It works like this.

[lua]

  1.    local function loadAddressBook()
  2.        local PermissionStatus = native.showPopup(“addressbook”, {option = “getPermission”})
  3.         local function checkAuthorization()
  4.            – print(“checkAuthorization is called”)
  5.             
  6.             --alert is displayed if Permission is Denied or Restricted
  7.             local function removePermissionAlert(event)
  8.                 if “clicked” == event.action then
  9.                     i = event.index
  10.                     if 1 == i then   
  11.                       --dismiss the alert  
  12.                        – audio.play(EnterButtonSound)
  13.                         
  14.                     elseif 2 == i then     
  15.                     else
  16.                     end
  17.                 end
  18.                 return true
  19.             end
  20.             
  21.             if PermissionStatus == “authorized” then
  22.                 print("*****Contact Book Permission authorized")
  23.                 – use your existing params and callback function
  24.                 native.showPopup( “addressbook”, pickContactOptions )
  25.                 
  26.             elseif PermissionStatus == “denied” then
  27.                 native.showAlert(“Authorization Denied!”, “To allow Authorization, Go to Settings > Privacy > Contacts > Select YourAppName”, {“OK”}, removePermissionAlert)
  28.            --do something
  29.                 
  30.             elseif PermissionStatus == “requestPermission” then
  31.               --if permission is asked for, call the function again to see the requested result
  32.             checkAuthorization()
  33.                 
  34.             elseif PermissionStatus == “restricted” then
  35.                 native.showAlert(“Authorization Restricted!”, “Access to the users Contacts is restricted due to parental settings”, {“OK”}, removePermissionAlert)
  36.                – do something since permission restricted
  37.                 
  38.             else print(“PermissionStatus ==”, PermissionStatus)
  39.                
  40.             end
  41.         end
  42.         
  43.         print(“Flag1 PermissionStatus ==”,PermissionStatus)
  44.         
  45.         checkAuthorization()
  46.         
  47.     end
  48. [/lua]

here’s the link.

https://forums.coronalabs.com/topic/60012-addressbook-plugin-crash-on-ios-9/

Nail

Hi Rob . i managed to make it work asking first for permission to access the contacts

but i am not yet able to get the data from the filter .

i want to copy the mobile Number so i can use it later

here is my code

 

local function ListContacts( event ) native.showPopup("addressbook", { option = "getPermission", option = "pickContact", hideDetails = true, --performDefaultAction = true, filter = {"firstName"}, listener = onPopupDismiss }) end local function onPopupDismiss( event ) data1=event.data pasteboard.copy( "string",data1 ) end

till now i am not able to get the event.data . i am trying here the firstName to check if i can get that data or not

btw in iphone i can see filed Mobile . but i couldnot find that field on the option parm in corona docs . i found only phonemobile but i dont think they are the same .

i will keep trying to get the data and will tell you later
 

Thanks Portal5B ( i  were replying same time as you )

yes it was about th permission . but i still face main issue getting filtered data .

sobh…here’s my listener, give it a try and you will see what is contained in event.data. 

It looks for “custom” labels for email and phone so they don’t get dropped when importing.

It also looks for Zip Codes, they are now in caps.  homeZIP for ex.

[lua]

   local function onComplete( event )
        print("")
        print("")
        print(“onComplete(event) / import Contact”)
        print( “*********event.name:”, event.name );
        print( “*********event.type:”, event.type );
        
        – event.data is either a table or nil depending on the option chosen
        print ( “***********event.data:”, event.data );
        
        print("********** event.data.note == “, event.data.notes)
        print(”********** event.data.lastName == “, event.data.lastName)
        
        local firstName, lastName = “”, “”
        
        – If there is event.data print it’s key/value pairs
        if event.data then
            
            if D then  --create table to store Contact Info Data
                D = nil
                D = {}
            else
                D = {}
            end
            
            print( “********event.data: {” );
            
            for k, v in pairs( event.data ) do
                local kk, vv = k, v
                
                if type( v ) == “note” then
                    vv = “note”
                    print(”***** vv = note ==", vv)
                    
                end
                
                if type( v ) == “table” then
                    vv = “table”
                    print("****** table FOUND table == “, vv)
                    print(”****** table key == “, kk)
                end
                
                if type( v ) == “userdata” then
                    vv = “userdata”
                    print(”******* userData == “, userData)
                end
                
                if “notes” == k then
                    print(”********* notes == “, notes)
                    – else print (”******* NO notes")
                end
                
                if “note” == k then
                    print("********* note == “, note)
                    –  else print (”******* NO note")
                end
                
                – Print the picture table
                if “picture” == k then
                    for a, b in pairs( v ) do
                        print( a, b )
                        --PhotoFileName
                        if a == “fileName” then
                            D.fileName = b
                            print(">>>>>>>>>!!! Picture Key == “…a…”  fileName == “…b)
                        end
                    end
                end
                
                --textBox.text = textBox.text … " " … kk … “:  " … vv … “\n”
                
                --displays each Key/Value pair in Table
                --This will show “custom” labels for email and cell phone
                print( k , “:” , v );
                
                – Set the first name
                if “string” == type( v ) then
                    
                    – New Code to find Email Addresses and add “Email” to end of Key string
                    local EmailFlag1 = string.find(v, “@”)
                    local EmailFlag2 = string.find(v, “.”)
                    
                    print(“EmailFlag1 == “, EmailFlag1)
                    
                    if EmailFlag1 ~= nil and EmailFlag2 ~= nil then
                        print(“Email Address Found!!!”)
                        
                        k = “”…k…“Email?”
                        
                        D[””…k…””] = v
                        
                        print(“emailKey : k == “…k…””)
                        –  print(“D.k == “, D.k)
                        – print(“D[””…k…”"] == " …D[""…k…""]…")
                    end
                    --End New Code
                    
                    --New Code to find phone numbers
                    local PhoneFlag2 = string.find(v, “%(%d%d%d%)”)
                    
                    
                    print(“PhoneFlag2 == “, PhoneFlag2)
                    print(“PhoneFlag2 k == “,k)
                    print(“PhoneFlag2 v == “,v)
                    
                    if PhoneFlag2 ~= nil then
                        print(“PhoneNumber Found!!!”)
                        
                        k = “”…k…“PhoneNumber?”
                        
                        D[””…k…””] = v
                        
                        print(“k == “…k…””)
                        –  print(“D.k == “, D.k)
                        – print(“D[””…k…””] == " …D[”"…k…""]…")
                    end
                    
                    – End Find Phone Number Code
                    
                    --Names
                    
                    if k == “firstName” then
                        D.firstName = v
                        
                        – Set the second name
                    elseif k == “lastName” then
                        print("**********>>>>>>>>>>>>")
                        print("********** k == ‘lastName’ == “, k)
                        D.lastName = v
                        
                    elseif k == “middleName” then
                        D.middleName = v
                        
                    elseif k == “prefix” then
                        D.prefix = v
                        
                    elseif k == “suffix” then
                        D.suffix = v
                        
                    elseif k == “organization” then
                        D.organization = v
                        
                    elseif k == “jobTitle” then
                        D.jobTitle = v
                        
                    elseif k == “birthday” then
                        D.birthday = v  
                        
                    elseif k == “nickName” then
                        D.nickName = v   
                        
                    elseif k == “anniversary” then
                        D.anniversary = v
                        
                    --[[]    --PhotoFileName
                    elseif k == “fileName” then
                        print(”************* fileName == “…k…” / v == “…v)
                        D.fileName = v --]]
                        
                        --Other
                        
                    elseif k == “phoneticFirstName” then
                        D.phoneticFirstName = v
                        
                    elseif k == “phoneticMiddleName” then
                        D.phoneticMiddleName = v
                        
                    elseif k == “phoneticLastName” then
                        D.phoneticLastName = v
                        
                        --Emails
                        
                    elseif k == “homeEmail” then
                        D.homeEmail = v
                        
                        print(”*** homeEmail FOUND!")
                        print(“D.homeEmail == “, D.homeEmail)
                        
                    elseif k == “workEmail” then
                        D.workEmail = v
                        
                    elseif k == “email” then
                        D.email = v
                        print(”…email found!”)
                        print("…D.email == “, D.email)
                        
                        --Phone
                        
                    elseif k == “phoneHome” then
                        D.phoneHome = v  
                        
                    elseif k == “phoneWork” then
                        D.phoneWork = v   
                        
                    elseif k == “phoneIphone” then
                        D.phoneIphone = v  
                        
                    elseif k == “phoneMobile” then
                        D.phoneMobile = v   
                        
                    elseif k == “phoneMain” then
                        D.phoneMain = v
                        
                    elseif k == “note” then
                        D.notes = v
                        print(”******* note Found! note == “, D.notes)
                        
                    elseif k == “notes” then
                        D.notes = v
                        print(”******* notes Found! notes == “, D.notes)
                        
                        --fax
                        
                    elseif k == “faxHome” then
                        D.faxHome = v   
                        
                    elseif k == “faxWork” then
                        D.faxWork = v  
                        
                    elseif k == “faxOther” then
                        D.faxOther = v   
                        
                        --pager
                        
                    elseif k == “pager” then
                        D.pager = v  
                        
                        --URLS
                        
                    elseif k == “homePageUrl” then
                        D.homePageUrl = v   
                        
                    elseif k == “workUrl” then
                        D.workUrl = v  
                        
                    elseif k == “homeUrl” then
                        D.homeUrl = v  
                        
                        --address
                        
                    elseif k == “homeStreet” then
                        D.homeStreet = v   
                        
                    elseif k == “homeCity” then
                        D.homeCity = v  
                        
                    elseif k == “homeState” then
                        D.homeState = v
                        
                    elseif k == “homeZIP” then
                        D.homeZip = v   
                        
                    elseif k == “homeCountry” then
                        D.homeCountry = v  
                        
                    elseif k == “workStreet” then
                        D.workStreet = v
                        
                    elseif k == “workCity” then
                        D.workCity = v  
                        
                    elseif k == “workState” then
                        D.workState = v
                        
                    elseif k == “workZIP” then
                        D.workZip = v  
                        
                    elseif k == “workCountry” then
                        D.workCountry = v
                        
                    elseif k == “otherStreet” then
                        D.otherStreet = v
                        
                    elseif k == “otherCity” then
                        D.otherCity = v
                        
                    elseif k == “otherState” then
                        D.otherState = v
                        
                    elseif k == “otherZIP” then
                        D.otherZip = v  
                        
                    elseif k == “otherCountry” then
                        D.otherCountry = v
                        
                    elseif k == “otherStreet1” then
                        D.otherStreet1 = v
                        
                    elseif k == “otherCity1” then
                        D.otherCity1 = v
                        
                    elseif k == “otherState1” then
                        D.otherState1 = v
                        
                    elseif k == “otherZip1” then
                        D.otherZip1 = v  
                        
                    elseif k == “otherCountry1” then
                        D.otherCountry1 = v
                        
                    elseif k == “otherStreet2” then
                        D.otherStreet2 = v
                        
                    elseif k == “otherCity2” then
                        D.otherCity2 = v  
                        
                    elseif k == “otherState2” then
                        D.otherState2 = v
                        
                    elseif k == “otherZIP2” then
                        D.otherZip2 = v  
                        
                    elseif k == “otherCountry2” then
                        D.otherCountry2 = v    
                        
                    elseif k == “otherStreet3” then
                        D.otherStreet3 = v
                        
                    elseif k == “otherCity3” then
                        D.otherCity3 = v   
                        
                    elseif k == “otherState3” then
                        D.otherState3 = v
                        
                    elseif k == “otherZIP3” then
                        D.otherZip3 = v  
                        
                    elseif k == “otherCountry3” then
                        D.otherCountry3 = v    
                        
                    elseif k == “otherStreet4” then
                        D.otherStreet4 = v
                        
                    elseif k == “otherCity4” then
                        D.otherCity4 = v  
                        
                    elseif k == “otherState4” then
                        D.otherState4 = v
                        
                    elseif k == “otherZIP4” then
                        D.otherZip4 = v  
                        
                    elseif k == “otherCountry4” then
                        D.otherCountry4 = v     
                        --People
                        
                    elseif k == “father” then
                        D.father = v  
                        
                    elseif k == “mother” then
                        D.mother = v
                        
                    elseif k == “parent” then
                        D.parent = v  
                        
                    elseif k == “brother” then
                        D.brother = v
                        
                    elseif k == “sister” then
                        D.sister = v  
                        
                    elseif k == “child” then
                        D.child = v
                        
                    elseif k == “friend” then
                        D.friend = v
                        
                    elseif k == “spouse” then
                        D.spouse = v  
                        
                    elseif k == “partner” then
                        D.partner = v
                        
                    elseif k == “assistant” then
                        D.assistant = v
                        
                    elseif k == “manager” then
                        D.manager = v  
                        
                        --Social
                        
                    elseif k == “socialFacebook” then
                        D.socialFacebook = v
                        
                    elseif k == “socialTwitter” then
                        D.socialTwitter = v
                        
                    elseif k == “socialGameCenter” then
                        D.socialGameCenter = v  
                        
                    elseif k == “socialFlickr” then
                        D.socialFlickr = v
                        
                    elseif k == “socialLinkedIn” then
                        D.socialLinkedIn = v  
                        
                    elseif k == “socialMyspace” then
                        D.socialMyspace = v
                        
                    elseif k == “socialSinaWeibo” then
                        D.socialSinaWeibo = v
                        
                    elseif k == “instantMessagingFacebook” then
                        D.instantMessagingFacebook = v  
                        
                    elseif k == “instantMessagingAim” then
                        D.instantMessagingAim = v
                        
                    elseif k == “instantMessagingGaduGadu” then
                        D.instantMessagingGaduGadu = v  
                        
                    elseif k == “instantMessagingGoogleTalk” then
                        D.instantMessagingGoogleTalk = v
                        
                    elseif k == “instantMessagingICQ” then
                        D.instantMessagingICQ = v  
                        
                    elseif k == “linstantMessagingJabber” then
                        D.instantMessagingJabber = v
                        
                    elseif k == “instantMessagingMSN” then
                        D.instantMessagingMSN = v  
                        
                    elseif k == “instantMessagingQQ” then
                        D.instantMessagingQQ = v
                        
                    elseif k == “instantMessagingSkype” then
                        D.instantMessagingSkype = v  
                        
                    elseif k == “instantMessagingYahoo” then
                        D.instantMessagingYahoo = v
                        
                    else
                    end
                    textBox.text = textBox.text … " " … kk … “:  " … vv … “\n”
                end
            end    
            
            – Set the contacts name
            – contactName.text = “Selected Contact:\n " … D.firstName … " " … D.lastName
            
            local Name = “Selected Contact: \n”
            
            if D.prefix then
                if D.prefix ~= “” then
                    Name = “”…Name…””…D.prefix  
                end
            end
            
            if D.firstName then
                if D.firstName ~= “” then
                    Name = Name…” “…D.firstName
                end
            end
            
            if D.middleName then
                if D.middleName ~= “” then
                    Name = Name…” “…D.middleName
                end
            end
            
            if D.lastName then
                if D.lastName ~= “” then
                    Name = Name…” “…D.lastName
                end
            end
            
            if D.suffix then
                if D.suffix ~= “” then
                    Name = Name…” “…D.suffix
                end
            end
            
            – contactName.text = contactName.text…”\n\n"
            
            --contactName.y = 85
            
            if contactName then
                display.remove(contactName)
                contactName = nil
            end
            
            contactName = display.newText( Name, 10, 65, native.systemFontBold, 16 )
            
            contactName:setReferencePoint(display.TopLeftReferencePoint)
            contactName:setFillColor( 0, 0, 0 )
            PickContactGroup:insert(contactName)
            
            print( “}” );
            print("…D.homeEmail == ", D.homeEmail)
        end        
    end
  

[/lua]

Hope this helps.

Nail

I should have told you, my listener adds a suffix to emails and phone number keys so I can find them when I parse the table later where I remove then remove the suffixs.

I was frustrated I couldn’t get custom key’s, the workaround seems to work.

Nail

Thanks Nail, i will give it a try