0

i'developing an application that has feature to select a contact from Contacts list.

Problem is, when i run application in "DEBUG" mode and debug my ContactPicker code, the picker runs quite thouroughly.

but when i run application in the device without debugging by simply delpoying it and choose option to "Select from Contact List" the app suddenly crashes and "Start screen" appears directly.

Anyone know what is this problem?

Here's snippet of my code::

private async Task SelectContacts()
{
  try
  {
       ContactPicker contactPicker = new ContactPicker();
       contactPicker.desiredFieldsWithContactFieldType.append(ContactFieldType.PhoneNumber);

       Contact contact = await contactPicker.PickContactAsync();

    if (contact != null)
    {
        Account acc = new Account();
        ...
        ...
        ...
        //my next implementation
    }
   }
   catch (Exception)
   {
      throw;
   }
}
4

1 回答 1

0

几天前我遇到了同样的问题,我无法弄清楚问题是什么。虽然我找到了适合我情况的解决方案,但我不能保证它对你有用。

所以,如果除了这个联系人选择器之外你没有写太多代码,我建议重新创建项目,或者创建一个新项目,然后首先添加联系人选择器代码,然后再进行其他任何操作。这就是我所做的,然后添加了我的其余代码并且它起作用了。我的应用程序没有抛出异常,联系人选择器在半秒不活动或只是在联系人列表中简单滚动后使应用程序崩溃。因此,联系人选择器出现然后崩溃。

希望这可以帮助。

于 2015-09-15T17:51:39.683 回答