2012-10-15 1 views
0

iPhone 5에 연락처 저장을 위해 Appcelerator titanium sdk를 사용하고 있으며 iOS 5 및 iOS 6 시뮬레이터에서 응용 프로그램이 제대로 작동하지만 iPhone 5 (실제 장치) 및 저장시 전화 번호부에 내 연락처 및 충돌입니다. iPhone 4 및 4s 장치 및 시뮬레이터에서 완벽하게 작동하므로 문제가 무엇인지 파악할 수 없습니다.에 추가 연락처 Crashing on iPhone 5

addBtn.addEventListener('click', function(){ 

    var isContactPresent = 'false'; 
    var people = Titanium.Contacts.getAllPeople(); 

    for (var i = 0; i < people.length; i++) { 
     Ti.API.info("People object is: "+people[i]); 


     var title = people[i].fullName; 
     if (!title || title.length === 0) { 
      title = "(no name)"; 
     } 

     if (win_3.titleStr === title) { 

      Ti.API.info('Address Book ' + title); 
      Ti.API.info('Contacts to be added ' + win_3.titleStr); 

      isContactPresent = 'true'; 

      var dialog = Ti.UI.createAlertDialog({ 
      message: 'Contact has already been added in Address Book', 
      ok: 'Ok', 
      title: 'Contacts Present' 
      }).show(); 

      break; 

     } 
    } 

    if(isContactPresent == 'false') { 
      SaveContacts(); 

      var dialog = Ti.UI.createAlertDialog({ 
      message: 'Contact has been added successfully', 
      ok: 'Ok', 
      title: 'Contacts Added' 
      }).show(); 
    } 

    //alert('Contact has been added successfully'); 
}); 

function SaveContacts() { 

    Ti.API.info('Win Email ' + win_3.emailStr); 
    Ti.API.info('Win Phone ' + win_3.phoneStr); 


    var contact_type = "home"; 

    var contact = Titanium.Contacts.createPerson(); 

    contact.kind = Titanium.Contacts.CONTACTS_KIND_ORGANIZATION; 
    contact_type = "work"; 
    contact.organization = win_3.titleStr; 

    if (win_3.emailStr != ' ' || win_3.emailStr != '') { 
     contact.email = {contact_type: [win_3.emailStr]}; 
    } else { 

     win_3.emailStr = ' '; 
     win_3.emailStr = 'Testing'; 
     contact.email = {contact_type: [win_3.emailStr]}; 
    } 

    if (win_3.phoneStr != ' ' || win_3.phoneStr != '') { 
     contact.phone = {contact_type: [win_3.phoneStr]}; 
    } else { 

     win_3.phoneStr = ' '; 
     win_3.phoneStr = '11231323'; 
     contact.phone = {contact_type: [win_3.phoneStr]}; 
    } 

    Titanium.Contacts.save(); 

} 
+0

이 충돌의 디버그 로그를 게시하시기 바랍니다이 더 코드 다음 우리를 말할 것이다. – rckoenes

답변