Fileprovider does not get loaded when application is run from /Applications folder - macos

I have developed a functional Application that uses the new NSFileProviderReplicatedExtension.
Everything worked as expected until I started deployment and realized, that my application cannot add domain successfully while being run from /Applications folder.
Calling:
[NSFileProviderManager addDomain:fileProviderDomain completionHandler:^(NSError * _Nullable error){}];
This call results in error:
Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.}
Running the application from XCode build dir or ˜/Desktop fileprovider extension works as expected.
Upon closer inspection in console around a moment of calling "addDomain", I can see a line that does not come up when running the application from a different location.
kernel Sandbox: fileproviderd(448) deny(1) file-read-data /Applications/TestFileProvider.app
I have tried changing about everything in codesign and sandbox in build settings but no change.
I have also tried making app in Obj-C and swift too - makes no difference.
Any suggestions?
For reference here is my question on apple developer forums:
https://developer.apple.com/forums/thread/696254

Related

Safari extension builded with Xcode, disappears from Safari after rebuild

I'm trying to build a Safari extension using Xcode, using this manual: https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension
The first time it builds fine and actually works, however if I want to rebuild it after changes, the extension disappears from Safari.
Here're Few parameters I'm using:
Xcode app is build on Cacoa App template
App contains a Safari Extension target
Safari Allowed Unsigned Extension is checked
Console is throwing the following errors:
plug-in <private> pre-screen sees activating state
Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named ext.demo.Extension" UserInfo={NSDebugDescription=connection to service named ext.demo.Extension}
PlugInKit error in beginUsing: with plugin identifier: <private>, killing plugin
I guess I am missing something important here...
Do a Clean Build Folder under the Product menu - or - Shift-Command-K before you run it again, and you should be good to go!

Cannot run exported application

I've developed a simple MacOS application (i.e. a product consisting of main application and launch helper application) with Xcode 9.4. Application runs fine in Xcode. I've archived and exported the app (either "Export without re-signing" or "Development" using "Automatic signing"). The export process runs without errors.
However, it is not possible to the application. Upon starting outside of Xcode, nothing happens; no error message etc.
How can this be further diagnosed?
Finally found it thanks to #clemens. Embedded libraries have their place inside the generated package in /Contents/Frameworks. Since I had previously embedded a login item I had set a /Contents/Library/LoginItems target path that was used below Frameworks which is clearly not the expected place. Removing the library, cleaning the path and re-adding fixed it for me.

Xcode 7.0.1 - cannot run application cocoa error - 102

I've located an oddity:
On 10.10.5 I can open xcode, start a new project, iOS single view application, arbitrary product name, Swift as the language and all other values default, build and run the application.
As an admin, this executed as expected.
As a non admin user however it competes the build and then fails to run with the error "The operation couldn't be competed. (Cocoa error - 102.)"
I've checked permissions on everything and all looks well.
Can anyone point me to a fix?
I was able to fix this by removing all my extensions, doing a full clean, re-adding the extensions in the build-phases tab and then running the app again.

Very Frustrating Sandboxing Error

To preface, I haven't changed any code or entitlements in my app. It always built and worked great but now all of a sudden I am getting this error.
12/8/15 10:05:45.388 AM appleeventsd[51]: A
sandboxed application with pid 2414, "XXX" checked in with
appleeventsd, but its code signature could not be read and validated
by appleeventsd, and so it cannot receive AppleEvents targeted by
name, bundle id, or signature. Install the application in
/Applications/ or some other world readable location to resolve this
issue. Error=ERROR: #100013 {
"NSDescription"="SecCodeCopySigningInformation() returned 100013, -."
} (handleMessage()/appleEventsD.cp #2098) com.apple.root.default-qos
I have tried the following
Install the app in "Applications" as the error suggest.
Restart the computer.
Delete the container and empty the trash.
Killing off cfprefsd. Both root and user.
Re-installing Xcode.
Removing the "Developer" folder in my Library.
Running the app in a virtual machine with a brand new install of my app.
Recreate all my developer certificates, provisioning profiles, etc...
None of the above works.
I have also tried all suggestions in the following links
Mac sandbox created but no NSUserDefaults plist
Error while implementing Sandbox: "deny file-read-metadata /Library"
Can't code sign helper app properly
Error in Sandboxed App, When loading Helper (LoginItems), code signing issue
And nothing has resolved the issue. My app, all of a sudden stopped working.
I think I figured it out. I re-wrote the code for creating a security scoped bookmark... all is working again. I couldn't find any differences but I think it was something in my code.

Error in Sandboxed App, When loading Helper (LoginItems), code signing issue

I'm trying to get out of this problem (I hope it's the last!)
Briefly, I have one status bar app, which needs to start at login.
I followed this tutorial http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/
Everything it's working, but when it's time for testing the app in a real contest, outside xcode, I end up with this message in the console system.log:
appleeventsd[52]: <rdar://problem/11489077> A sandboxed application with pid 1258, "xxxxx" checked in with appleeventsd, but its code signature could not be validated ( either because it was corrupt, or could not be read by appleeventsd ) and so it cannot receive AppleEvents targeted by name, bundle id, or signature. Error=ERROR: #-67061 { "NSDescription"="SecCodeCheckValidity() returned -67061, <SecCode 0x7fb0ea714300 [0x7fff71381e10]>." } (handleMessage()/appleEventsD.cp #2072) client-reqs-q
What i did was checking the code signature with this command: spctl --assess --type execute AppName
The result was code signature ok for both the Main app, and the Helper app.
As you can see in the tutorial the helper app project is kept inside the main app project. Maybe this is the cause?
I've tried different Signing profiles, now i'm using "Mac Distribuition"
I'm using OsX Mavericks DP6 And Xcode 5 beta ..
Any ideas?
For anyone else finding this post, I believe the answer is here: Can't code sign helper app properly
Try running from /Applications and see if you still get the message in the console.
Check the permissions of the application bundle ( and the path to the bundle ) to insure that the appleeventsd and/or securityd daemons can read the executable.
Try to run the helper itself (from Xcode or Finder) to see that everything is fine with that.
In my case it did not run, because the appdelegate object was missing from xib.
After I fixed that it run fine and launched my app from the Application folder

Resources