I just investigated the same error.
Its essence is that the security service apple is used to communicate with the keychain, in rare cases, when the user device has low memory, the application’s ability to talk to the keychain crashes and disables, the results of which are terrible -34018.
This happens not only when using Xcode, as some might argue.
This is the latest problem data from an Apple developer forum by an Apple employee:
UPDATE: finally, we were able to reproduce the error -34018 on iOS 8.3. This is the first step in identifying the root cause, and then coming up with a fix.
As usual, we cannot fix the release timeframe, but this has affected many developers, and we really want this to be resolved.
Earlier, I suggested adding a little delay to application: didFinishLaunchingWithOptions and applicationDidBecomeActive: before accessing the keychain as a workaround. However, this does not actually help. This means that at this time there is no known workaround other than resuming the application.
The problem seems to be related to memory pressure, so perhaps more aggressive ones in handling memory alerts can alleviate the problem.
From another Apple employee:
- Keychain technology knows well how important this problem is.
- The main problem is reproducing the crash here at Apple.
- Now we can do it (thanks in large part to the work that you guys have filed for and keep track of bug reports).
From another Apple employee on March 22, 2016 :
Ok last. This is a complex problem with several possible causes: some cases of the problem are caused by incorrect subscription to the application. You can easily distinguish this case because the problem is 100% reproducible. Some examples of the problem are caused by a bug in how iOS supports application development (23,991,853). This debugging was complicated by the fact that another error in the OS (t. 23,770,418) masked its effect, which means that the problem only occurred when the device was under memory pressure. We believe that these problems were resolved in iOS 9.3. We suspect that there may be even more causes for this problem. So, if you see this problem on a user device (one which Xcode did not talk to) that is running iOS 9.3 or later, please report an error. Try turning on the device; the system logs your error report (I understand that it can be difficult when working with client devices; one of the options is to ask the client to install Apple Configurator, which allows you to view the system log). And also if you make a mistake, send your error number, just for the record. On behalf of Apple Id, I like to thank everyone for their efforts to find this rather terrible problem. Share and Enjoy
Unfortunately, there are no known workarounds, and the problem is still not fixed in 9.3.2 Beta 1 (13F51a)