You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
In all examples we are firing onContactsDataProviderErrorSignal on dataproviders, but there is no subscription to this event in the OHContactDataSource file , so currently it is very difficult to catch NSError from api calls in view controllers. So want to ask how to catch NSError events in viewcontroller using onContactsDataProviderErrorSignal , documentation lacks how to handle errors gracefully if we are loading contacts from remote datasource
The text was updated successfully, but these errors were encountered:
Hi Ajay, the data source itself doesn't handle errors from the data providers. Instead, you should add your view controller as the observer for the onContactsDataProviderErrorSignal on each of the data providers you are using. So, in your view controller class, you will have something along the lines of:
// Initialize the data provider.
letdataProvider=OHCNContactsDataProvider(delegate:self)
// Add the error handler.
dataProvider.onContactsDataProviderErrorSignal.addObserver(self, callback:{(error, dataProvider)in
// Handle the error.
})
// Initialize the data source.
letdataSource=OHContactsDataSource(dataProviders:NSOrderedSet(objects: dataProvider), postProcessors:NSOrderedSet())
dataSource.onContactsDataProviderFinishedLoadingSignal.addObserver(self, callback:{(contacts)in
// Everything was successful.
})
// Load the contacts from the data provider into the data source.
dataSource.loadContacts()
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In all examples we are firing onContactsDataProviderErrorSignal on dataproviders, but there is no subscription to this event in the OHContactDataSource file , so currently it is very difficult to catch NSError from api calls in view controllers. So want to ask how to catch NSError events in viewcontroller using onContactsDataProviderErrorSignal , documentation lacks how to handle errors gracefully if we are loading contacts from remote datasource
The text was updated successfully, but these errors were encountered: