1

Xamarin iOS app crashes when trying to insert into the SQLite database after reading data from an API endpoint, it reports this error:

Remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.

I have checked the size of the data coming from the API and its only 544kb. I am able to display the data to the screen with only updating the database but I need them to insert into the database so that I can allow the user to search the items from the SQLite database. If I uninstall the app and run it again, it works fine until I put it in the background and bring it back, then it crashes.

//Deserializing the data from the API and storing them into a list 
IEnumerable<Member> members = JsonConvert.DeserializeObject<IEnumerable<Member>>(json);
//this line below crashes the app
await Db.InsertAllAsync(members);
//the update works very well
await store.UpdateItemsAsync(members);

membersStore = store;

the app reports this error on iOS both on simulator and an iPhone

2019-04-11 10:29:05.797858-0300 CHA.iOS[8019:113508] [Client] Remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-04-11 10:29:05.798118-0300 CHA.iOS[8019:113434] [NetworkInfo] Descriptors query returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-04-11 10:29:05.798321-0300 CHA.iOS[8019:113515] [Client] Sending selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSD ebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.} Unhandled Exception:

Iain Smith
  • 9,230
  • 4
  • 50
  • 61
  • try putting a try/catch around the suspect code and see what exception it is throwing. – Jason Apr 11 '19 at 13:37
  • I did that but try n catch does not catch the error, it just jumps to the main.cs where the app crashes but it I get "index was out of range must be non-negative and less than the size of the collection" when I put a breakpoint on that line. – Charles Aondo Apr 11 '19 at 13:58
  • Have you had a look at this https://stackoverflow.com/q/52455652/1107580 – Iain Smith Apr 11 '19 at 14:16
  • it looks like for the simulator, running this will fix it `xcrun simctl spawn booted log config --mode "level:off" --subsystem com.apple.CoreTelephony` – Iain Smith Apr 11 '19 at 14:16
  • What OS version and Xcode version are you running? – Iain Smith Apr 11 '19 at 14:17
  • @IainSmith running the command you gave solve the com.apple.commcenter.coretelphony.xpc error, now I am getting this error "Index was out of range. Must be non-negative and less than the size of the collection" in the try n catch block on the await Db.InsertAllAsync(members); line of code. I am running iOS 12.2 and Xcode 10.2 – Charles Aondo Apr 11 '19 at 15:08
  • What is the object `members` once it has deserialized? Empty? – Iain Smith Apr 11 '19 at 15:13
  • @IainSmith It is not empty, its a list containing JSON objects that have been deserialized into a readable format. – Charles Aondo Apr 11 '19 at 16:00
  • await Db.InsertAllAsync(JsonConvert.DeserializeObject>(json)).ContinueWith(async t => await store.UpdateItemsAsync(Db.QueryAsync("SELECT * FROM Member GROUP BY DisplayName").Result);....This is same code works on android, but will crash the app on ios, so I am trying to implement similar thing using a if statements that targets only ios device – Charles Aondo Apr 11 '19 at 16:27

0 Answers0