NSURLSession from macos Sharing Extension - macos

I'm getting this error in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { URLSessionDataDelegate method:
error=Optional(Error Domain=NSURLErrorDomain Code=-1 “unknown error”
UserInfo={NSErrorFailingURLKey=https://www.example.com/,
NSLocalizedDescription=unknown error,
NSErrorFailingURLStringKey=https://www.example.com/})
Very similar code works perfectly from an application, but I'm trying to write an Sharing App Extension which uploads to a webserver.
I'm using URLSessionConfiguration.background(withIdentifier:"...") same as my desktop application.
Why do I get erorr -1?

I was missing the com.apple.security.network.client entitlement in the entitlements file.
https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9

Related

Can't download a file in file provider because of a system error

I have created an extension via the fileprovider template and adopts fileprovider protocols in Xcode. But when i download a file, the system throws the error:
"Couldn't communicate with helper application".
From the system log i can see that the fetch-content failed with such error:
┳139b4 ‼️ done executing <FP2 ‼️ fetch-content(a file 1)
why:materialization|itemChangedRemotely
sched:userInitiated.1647482996.810533#1647482996.810533
error:<NSError: Cocoa 4101 "Couldn't communicate with helper
application." Underlying={NSError: POSIX 2 "couldn't issue sandbox
extension com.apple.app-sandbox.read-write for
'/f/db641e9a04e144c6b320': No such file or directory" }}>>
Any advise would be appreciated, thanks!

puppeteer-sharp Failed to launch Base

I have implemented it in my local and works well. But when I moved the changes to the window server it's giving the below error
Failed to launch Base! [0402/075840.212:ERROR:os_crypt_win.cc(70)] Failed to encrypt: The system cannot find the file specified. (0x2)\r\n[0402/075840.212:FATAL:headless_browser_main_parts.cc(103)] Check failed: OSCrypt::Init(local_state_.get()). \r\nBacktrace:\r\n\tIsSandboxedProcess [0x00007FFC31341842+705042]\r\n\tIsSandboxedProcess [0x00007FFC312C39A2+189298]\r\n\tIsSandboxedProcess [0x00007FFC312D2AF8+251080]\r\n\tIsSandboxedProcess [0x00007FFC312D39E0+254896]\r\n\tRelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFC32B12123+12980755]\r\n\tRelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFC32B11E8D+12980093]\r\n\tovly_debug_event [0x00007FFC2F905929+16331561]\r\n\tovly_debug_event [0x00007FFC2FCC5B17+20264215]\r\n\tovly_debug_event [0x00007FFC2F904675+16326773]\r\n\tovly_debug_event [0x00007FFC2F9073BE+16338366]\r\n\tIsSandboxedProcess [0x00007FFC31DB7DB7+11675527]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC3125A837+8179991]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC3125B5AD+8183437]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC3125B20C+8182508]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC3125A1BD+8178333]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC3125A53A+8179226]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC31294D1A+8418810]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC31294BDC+8418492]\r\n\tCrashForExceptionInNonABICompliantCodeRange [0x00007FFC312949E7+8417991]\r\n\tChromeMain [0x00007FFC2E971238+408]\r\n\tOrdinal0 [0x00007FF6E8CF26B8+9912]\r\n\tOrdinal0 [0x00007FF6E8CF1A41+6721]\r\n\tGetHandleVerifier [0x00007FF6E8E3AF42+904642]\r\n\tBaseThreadInitThunk [0x00007FFC68F113F2+34]\r\n\tRtlUserThreadStart [0x00007FFC6AB054F4+52]\r\n\r\n
Can anyone please advise what should be the fix for the above error message?
We had the same error with default browser:
Failed to launch browser! [0428/113352.960:ERROR:os_crypt_win.cc(70)] Failed to encrypt
As #hardkoded suggested, using the revision 851527 we could launch the browser. Thank you!

Launch error | There is a problem launching using posix_spawn (error code: 2)

I am currently working on a project through github. My local project is connected to the github project folder through folder reference.Current File/Folder setup There hasn't been a problem, but now I keep getting the error "There is a problem launching using posix_spawn (error code: 2)." Before that, earlier today, I was receiving the error: "could not launch 'PROJECT NAME'. Internal error"
with the initial error ("could not launch 'PROJECT NAME'. Internal error") I attempted to fix the Schema configuration by following option B in this link (https://github.com/olilarkin/wdl-ol/issues/120). After attempting that I began receiving the later error ("There is a problem launching using posix_spawn (error code: 2).")posix_spawn Error
please help. Thanks

PhoneGap Build: Error: NOT_FOUND_ERR (missing files)

When I try to use my app from PhoneGap Build, it seems to be missing images. When I check in the Chrome web inspector, it's also missing script files. Here are the errors:
cordova.js:314 Uncaught Error: NOT_FOUND_ERR
at fileService.js:77
at fail (FileEntry.js:88)
at Object.callbackFromNative (cordova.js:295)
at <anonymous>:1:9
cordova.js:312 Error in Error callbackId: File410316782 : Error: NOT_FOUND_ERR
cordova.js:314 Uncaught Error: NOT_FOUND_ERR
at fileService.js:77
at fail (FileEntry.js:88)
at Object.callbackFromNative (cordova.js:295)
at <anonymous>:1:9
.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
I know I didn't fail to include this file, because it was working before.
Most issues like this, as well as "Upload Error [2]", can be solved in PhoneGap Build by deleting the app and re-uploading. Don't worry about losing anything, since all of your settings are in your config files. It seems that PhoneGap has a tendency to inadvertently retain or misplace files.
I tend to just delete my app and re-upload every time I need to run a build, so I don't have to waste time installing and opening the app, only to find out it's missing files.

Receiving "Failed to obtain sandbox extension for path" error in Swift Playground using Realm.IO

I have installed Realm.IO (0.97.0) using Cocoapods (0.39) into my project as instructed.
When I create a Swift playground (Xcode 7.2), with something like:
import RealmSwift
class Unit: Object {
dynamic var name = ""
}
let unit = Unit(value: ["name": "Moya"])
do {
try NSFileManager.defaultManager().removeItemAtPath(Realm.Configuration.defaultConfiguration.path!)
} catch {}
let realm = try! Realm()
realm.beginWrite()
realm.add(unit)
try! realm.commitWrite()
let results = realm.objects(Unit)
results.count
I get the error in the console:
2015-12-28 11:13:13.877 Realm[39396:2067298] Failed to obtain sandbox extension for path=/var/folders/gx/699y9yv15gg2zr5sqtmtpnt80000gp/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.Realm-395D9AEC-443D-446F-AF34-EB74AA840501/Library/Caches/com.apple.dt.playground.stub.iOS_Simulator.Realm-395D9AEC-443D-446F-AF34-EB74AA840501. Errno:1
2015-12-28 11:13:13.878 Realm[39396:2067298] Failed to obtain sandbox extension for path=/var/folders/gx/699y9yv15gg2zr5sqtmtpnt80000gp/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.Realm-395D9AEC-443D-446F-AF34-EB74AA840501/Library/Caches/com.apple.dt.playground.stub.iOS_Simulator.Realm-395D9AEC-443D-446F-AF34-EB74AA840501. Errno:1
The playground results themselves work as expected. However, this error is bothersome. What can I do to eliminate it?
Thanks.
The error you're facing might be just some internal state corruption in Xcode, it might help to restart Xcode and / or clear the caches (as seen in the error message).
Be aware though that there are some limitations with using Realm in playgrounds.

Resources