“Couldn’t communicate with a helper application” o

2019-03-18 00:02发布

问题:

I'm suddenly getting this error on Yosemite:

***storageTaskManagerExistsWithIdentifier:withIdentifier failed: 
Error Domain=NSCocoaErrorDomain 
Code=4099 "Couldn’t communicate with a helper application." 
(The connection to service named com.apple.nsurlstorage-cache was invalidated.) 

UserInfo=0x6000000621c0 
{NSDebugDescription=The connection to service named com.apple.nsurlstorage-cache was invalidated.}; 

The app was working perfectly on Mavericks. Any ideas what might be going on?

(I don't even have a clue where too look at... Sure, I have a WebView in there, but I haven't yet manage to figure out where the error is triggered...)

回答1:

This issue is very likely due to sandboxing as @ingrid already pointed out. But if you want to distribute our app(s) via the Mac App Store you can not just switch sandboxing off (which isn't recommended anyway). Instead enable the 'Outgoing Connections' capability.

  • Click on your project file
  • Choose the App's build target
  • On the 'Capabilities' tab extend 'App Sandbox'
  • Enabled the 'Outgoing Connections (Client)' checkbox



回答2:

I'm getting this problem also. Are you using NSAttributed string initWithHTML: method?

There is also a known problem with the open and save panels which rely on helper applications. (This would have been a comment but I can't leave comments yet!)



回答3:

@martn_st post is the first step, but Accroding to Fabric OSX Support: https://docs.fabric.io/apple/crashlytics/os-x.html

Intercepting and reporting uncaught exceptions on OS X is more complex than it is on iOS. On OS X, AppKit will catch exceptions thrown on the main thread, preventing the application from crashing, but also preventing Crashlytics from reporting them. To make matters worse, Apple’s frameworks are not exception safe. This means that while AppKit will prevent your app from crashing, it will also likely corrupt your process’s state, often including AppKit itself. Typically, once an exception involving UI interaction is thrown, it will prevent your app from working correctly from that moment on.

You need to Put the following code in didFinishLaunchWithOption

Swift 3

UserDefaults.standard.register(defaults: ["NSApplicationCrashOnExceptions": true])

Swift pre-3

NSUserDefaults.standardUserDefaults().registerDefaults(["NSApplicationCrashOnExceptions": true])

Objective-C

[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions": @YES }];



回答4:

I had this error too, in my case the file .entitlements the key App Sandbox was in "YES", I changed it to "NO".



回答5:

if you are using service, you don't have ui for that, so you in the {name}.entitlements you should add this key: com.apple.security.network.server as Boolean type and YES for value and/or com.apple.security.network.client as Boolean type and YES for value



回答6:

For those who got this problem with keyboard extension on iOS:

  1. Open Settings
  2. Keyboards
  3. [Select your keyboard here]
  4. Grant full access


回答7:

Open terminal and execute following two commands, I am using xcode 8

xcrun git config --global user.email you@yourdomain.com

xcrun git config --global user.name "Your Name Here"