Ionic-native: Ionic2 ionic-native/contacts fetching block UI

Created on 16 Aug 2017  路  3Comments  路  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[X] bug report
[ ] feature request

Current behavior:
On iOS 11 Beta fetching contacts block UI.
The issue reproduces on iPhone 6S and iPhone 7 Plus.

Expected behavior:
Fetching contacts should not block UI as on iOS 10.

Steps to reproduce:
Try import 5K contacts, during that period UI frozen.

Related code:

Injectable()
export class ImportPhonebookContact {
  importProcessed: boolean = false;

  constructor(private contacts: Contacts,
              private http: Http) {}

  import(): Promise<boolean> {
    if(this.importProcessed) {
      return Promise.resolve(this.importProcessed);
    } else {
      this.importProcessed = true;
    }
    console.time("Fetch contacts")
    return new Promise(resolve => {
      this.contacts.find(['displayName', 'phoneNumbers'], {
        multiple: true
      }).then(contacts => { 
        console.timeEnd("Fetch contacts")
        this.remoteExport(contacts);
        resolve(this.importProcessed);
      }).catch(console.log);
    });
  }

  private remoteExport(connections: Contact[]): void {
    const headers = new Headers();
    headers.append('Authorization', 'Bearer ' + localStorage.getItem('accessToken'));

    this.http.post(APP_CONFIG.apiUri + '/sync/phonebook', 
                   { connections: connections }, 
                   { headers }).toPromise();
  }
}

Other information:
Xcode output:

2017-08-16 12:54:12.784355+0300 Myapp[502:71606] Ionic Native: deviceready event fired after 2281 ms
2017-08-16 12:54:15.578481+0300 Myapp[502:71683] Resetting interest
2017-08-16 12:54:15.578545+0300 Myapp[502:71683] Increasing interest: 1
2017-08-16 12:54:15.581007+0300 Myapp[502:71683] Increasing interest: 2
2017-08-16 12:54:15.582130+0300 Myapp[502:71683] Increasing interest: 3
2017-08-16 12:54:15.583154+0300 Myapp[502:71683] Increasing interest: 4
2017-08-16 12:54:15.584084+0300 Myapp[502:71683] Increasing interest: 5
2017-08-16 12:54:15.585352+0300 Myapp[502:71683] Fetching in bulk 250 contacts!
2017-08-16 12:54:15.919986+0300 Myapp[502:71683] Fetching in bulk 250 contacts!
2017-08-16 12:54:16.226411+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:16.559840+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:16.867234+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:17.215888+0300 Myapp[502:71658] Fetching in bulk 250 contacts!
2017-08-16 12:54:17.548900+0300 Myapp[502:71658] Fetching in bulk 250 contacts!
2017-08-16 12:54:17.883738+0300 Myapp[502:71658] Fetching in bulk 250 contacts!
2017-08-16 12:54:18.209814+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:18.588213+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:18.942062+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:19.295545+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:19.702245+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:20.092949+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:20.449420+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:20.837158+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:21.220039+0300 Myapp[502:71657] Fetching in bulk 250 contacts!
2017-08-16 12:54:21.593841+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:21.932923+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:22.327521+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:22.869730+0300 Myapp[502:71738] Resetting interest
2017-08-16 12:54:22.869790+0300 Myapp[502:71738] Increasing interest: 1
2017-08-16 12:54:22.871022+0300 Myapp[502:71738] Increasing interest: 2
2017-08-16 12:54:22.872016+0300 Myapp[502:71738] Increasing interest: 3
2017-08-16 12:54:22.873033+0300 Myapp[502:71738] Increasing interest: 4
2017-08-16 12:54:22.873850+0300 Myapp[502:71738] Increasing interest: 5
2017-08-16 12:54:22.878584+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:23.222158+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:23.557272+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:23.872468+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:24.178993+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:24.503080+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:24.902068+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:25.263960+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:25.410705+0300 Myapp[502:71679] void SendDelegateMessage(NSInvocation *): delegate (webView:identifierForInitialRequest:fromDataSource:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
2017-08-16 12:54:25.644994+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:26.047446+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:26.418006+0300 Myapp[502:71670] Fetching in bulk 250 contacts!
2017-08-16 12:54:26.773450+0300 Myapp[502:71738] Fetching in bulk 250 contacts!
2017-08-16 12:54:27.204144+0300 Myapp[502:71738] Fetching in bulk 164 contacts!
2017-08-16 12:54:27.979844+0300 Myapp[502:71606] Fetch contacts: 12627ms

package.json info:

"@ionic-native/contacts": "^3.12.1",
"cordova-plugin-contacts": "git+https://github.com/apache/cordova-plugin-contacts.git",

Most helpful comment

i am having this issue. apache says ionic Contacts will no longer be supported as per https://jira.apache.org/jira/browse/CB-13218

what is the general solution for this? im sure it will affect alot of developers with ios 13 release

All 3 comments

Related to the plugin source.

i am having this issue. apache says ionic Contacts will no longer be supported as per https://jira.apache.org/jira/browse/CB-13218

what is the general solution for this? im sure it will affect alot of developers with ios 13 release

Related to the plugin source.

@danielsogl What does it means?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

ihadeed picture ihadeed  路  4Comments

mateo666 picture mateo666  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

JaneDawson picture JaneDawson  路  4Comments