How can crashes of Safari extensions on Mojave be avoided? - swift

When I build my macOS application that has an Safari extension in it, which I run on Safari, it crashes after a couple of seconds of running (though it does show up in the extensions).
It seems to be a problem of Safari trying to obtain data from the local Library folder. It also seems to struggle with Info.plist.
Here is the crash log:
2018-08-02 17:33:47.464379+0200 Safari[14693:1179568] [default] Unable to load Info.plist exceptions (eGPUOverrides)
2018-08-02 17:33:47.487993+0200 Safari[14693:1179565] [SQLiteStore] Failed to acquire database store coordination lock at /Users/lukasmuller/Library/Safari/Favicon Cache/favicons.db-lock: [35: Resource temporarily unavailable]
2018-08-02 17:33:47.488150+0200 Safari[14693:1179565] [SQLiteStore] Failed to acquire exclusive access to database at file:///Users/lukasmuller/Library/Safari/Favicon%20Cache/favicons.db.
2018-08-02 17:33:47.488580+0200 Safari[14693:1179565] [SQLiteStore] Failed to acquire database store coordination lock at /Users/lukasmuller/Library/Safari/Favicon Cache/favicons.db-lock: [35: Resource temporarily unavailable]
2018-08-02 17:33:47.488615+0200 Safari[14693:1179565] [SQLiteStore] Failed to acquire exclusive access to database at file:///Users/lukasmuller/Library/Safari/Favicon%20Cache/favicons.db.
2018-08-02 17:33:47.488694+0200 Safari[14693:1179565] [SQLiteStore] Falling back to an in-memory store
2018-08-02 17:33:47.489617+0200 Safari[14693:1179565] [FaviconPersistence] Using in-memory representation for database /Users/lukasmuller/Library/Safari/Favicon Cache/favicons.db
2018-08-02 17:33:47.505346+0200 Safari[14693:1179572] [SQLiteStore] Failed to acquire database store coordination lock at /Users/lukasmuller/Library/Containers/com.apple.Safari/Data/Library/Caches/com.apple.Safari/TabSnapshots/Metadata.db-lock: [35: Resource temporarily unavailable]
2018-08-02 17:33:47.505870+0200 Safari[14693:1179572] [SQLiteStore] Failed to acquire exclusive access to database at file:///Users/lukasmuller/Library/Containers/com.apple.Safari/Data/Library/Caches/com.apple.Safari/TabSnapshots/Metadata.db.
2018-08-02 17:33:47.572816+0200 Safari[14693:1179583] flock failed to lock maps file: errno = 35
2018-08-02 17:33:47.573799+0200 Safari[14693:1179583] flock failed to lock maps file: errno = 35
2018-08-02 17:33:47.604115+0200 Safari[14693:1179588] Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
2018-08-02 17:33:47.607520+0200 Safari[14693:1179588] Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
2018-08-02 17:33:47.608239+0200 Safari[14693:1179588] Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
2018-08-02 17:33:47.609424+0200 Safari[14693:1179588] Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
2018-08-02 17:33:47.857619+0200 Safari[14693:1179579] Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
2018-08-02 17:33:47.859043+0200 Safari[14693:1179565] [CrowdsourcedAutoFill] Unable to read cloud AutoFill correction sets, error: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-08-02 17:33:47.859839+0200 Safari[14693:1179579] Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
2018-08-02 17:33:47.871122+0200 Safari[14693:1179640] [CloudBookmarks] Error fetching remote migration state: Error Domain=com.apple.SafariBookmarksSync.CloudBookmarksErrorDomain Code=0 "(null)"
2018-08-02 17:33:47.953061+0200 Safari[14693:1179640] [RemotePlistController] The downloaded plist could not be loaded: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-08-02 17:33:48.191583+0200 Safari[14693:1179568] [trace] RWIMobileDeviceConnection (Direct): Unable to start a session: The host is not paired with the device.
2018-08-02 17:33:48.202902+0200 Safari[14693:1179568] [trace] RWIMobileDeviceConnection (Direct): Unable to stop session: The session is inactive.
2018-08-02 17:33:48.234006+0200 Safari[14693:1179572] Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at AutoFillCorrections.db.
2018-08-02 17:33:48.235327+0200 Safari[14693:1179572] Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
Failed to acquire exclusive access to AutoFill corrections SQLite store at CloudAutoFillCorrections.db.
2018-08-02 17:33:52.195337+0200 Hockey Crahses to Jira[14702:1180067] [default] Unable to load Info.plist exceptions (eGPUOverrides)
2018-08-02 17:30:28.465503+0200 Hockey Crashes to Jira[14575:1165922] [default] Unable to load Info.plist exceptions (eGPUOverrides)
2018-08-02 17:30:43.565677+0200 Hockey Crashes to Jira[14575:1165922] [default] Unable to load Info.plist exceptions (eGPUOverrides)
Has anyone faced similar problems and has figured out a way of fixing it?

I have the same (random) problem.
It seems the problem disappears after a cleaning of the project (Product/Clean) and of the build folder (Alt on Product/Clean menu)
However the message "[default] Unable to load Info.plist exceptions (eGPUOverrides)" is still present...
It does not seem to be relavant since everything works fine.
I have created a Slack community for Safari App Extensions devs, you are welcome to join us: https://slofile.com/slack/safariappextdevs

Basically, you're trying to run it on a device. For example, if you wish to run an iOS app on iOS-Device, you need provisioning profile. Similarly, if you wish to run an macOS app on macOS device, you've to set provisioning profile for it.
Select Project, select main target, make sure you've set the provisioning profile, team.
Also set the provisioning profile for safari extension target.
Once you're done setting up, run the safari extension.
Go to safari preferences, extensions tab & enable your extension.
Hope that helps. Cheers.

So, apparently :
The Xcode debugger kills the browser if no interaction/messaging is found during a certain lapse of time.
So to avoid this, what you have to do is to write that code inside your injected script :
setInterval(() => safari.extension.dispatchMessage("ping", {}), 1000);
I wrote this article that explains the common problems encountered while developing Safari App Extensions.

Related

Try to get to work Arducam IMX519 on Raspberry Pi

I have followed every step from the Arducam Gudie Arducam Guide IMX519. But I am getting the following message when I try to run libcamera-hello or libcamera-still -t 0:
libEGL warning: DRI2: failed to authenticate
Made X/EGL preview window
[0:05:54.878605558] [1851] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3897-c3c878a9
[0:05:54.879023852] [1866] ERROR MediaDevice media_device.cpp:479 /dev/media0[]: Failed to open media device at /dev/media0: Permission denied
[0:05:54.879141481] [1866] INFO DeviceEnumerator device_enumerator.cpp:218 Unable to populate media device /dev/media0 (Permission denied), skipping
[0:05:54.879220573] [1866] ERROR MediaDevice media_device.cpp:479 /dev/media3[]: Failed to open media device at /dev/media3: Permission denied
[0:05:54.879271443] [1866] INFO DeviceEnumerator device_enumerator.cpp:218 Unable to populate media device /dev/media3 (Permission denied), skipping
[0:05:54.879336850] [1866] ERROR MediaDevice media_device.cpp:479 /dev/media1[]: Failed to open media device at /dev/media1: Permission denied
[0:05:54.879385479] [1866] INFO DeviceEnumerator device_enumerator.cpp:218 Unable to populate media device /dev/media1 (Permission denied), skipping
[0:05:54.879447312] [1866] ERROR MediaDevice media_device.cpp:479 /dev/media2[]: Failed to open media device at /dev/media2: Permission denied
[0:05:54.879495515] [1866] INFO DeviceEnumerator device_enumerator.cpp:218 Unable to populate media device /dev/media2 (Permission denied), skipping
ERROR: *** no cameras available ***
I flashed multiple times and reinstalled everything. Checked the cable several times. But I always get the same error.
Hope someone can help me out here.
Thanks in advance.
I tried that guide too but have run into the same issue recently. Have you tried following this instruction from arducam forum to install the driver?
Install_pivariety_pkgs.sh update and FAQ
This resolved the no cameras available error and allowed me to run libcamera-still test successfully. I still cannot get libcamera-hello to work unfortunately.

Xcode 14 setAlternateIconName() stopped changing icon?

I'm using the same code in a few projects to change the icon from the app settings, but yesterday it stopped working.
I use
UIApplication.shared.setAlternateIconName("AppIcon-1")
Here's my info.plist
And I have AppIcon, AppIcon-1 and AppIcon-2 in Assets.
When I try to change the icon I get the following in log:
[default] +[LSApplicationProxy applicationProxyFor*] is not a supported method for getting the LSApplicationProxy for the current process, use +[LSBundleProxy bundleProxyForCurrentProcess] instead.
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}````
This is how I implement it.
But for the iPad it has different approach

React Map GL caches error when running in sandbox

I am trying to run the following in a sandbox environment but I keep running into the below error
`Uncaught DOMException: Failed to read the 'caches' property from 'Window': Cache storage is disabled
because the context is sandboxed and lacks the 'allow-same-origin' flag.
at dt (<anonymous>:566:12382)
at <anonymous>:566:14870
at <anonymous>:566:15177
at wt (<anonymous>:566:15230)
at kt (<anonymous>:566:16193)
at Object.getSession (<anonymous>:566:11811)
at Object.processRequests (<anonymous>:566:12233)
at Object.queueRequest (<anonymous>:566:9815)
at Object.getSessionAPI (<anonymous>:566:12004)
at Map._authenticate (<anonymous>:570:376250)`

AEM 6.2 create backup issue

While creating new online backup of my Author instance it is showing error showing below:
In the log it is showing error:
30.11.2017 12:11:59.105 *ERROR* [112.196.146.254 [1512043919094] GET /libs/granite/backup/content/createBackup/content/items/backupform.check.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
java.lang.RuntimeException: java.io.FileNotFoundException: /home/ubuntu/AEM/Dev/author/crx-quickstart/launchpad/felix/bundle305/data/classes/org/apache/jsp/libs/granite/backup/components/backupform/check_html_jsp.java (Permission denied)
at org.apache.sling.commons.fsclassloader.impl.FSClassLoaderProvider.getOutputStream(FSClassLoaderProvider.java:225)
at org.apache.sling.scripting.jsp.SlingIOProvider.getOutputStream(SlingIOProvider.java:145)
at org.apache.sling.scripting.jsp.jasper.JspCompilationContext.getOutputStream(JspCompilationContext.java:146)
at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.generateJava(Compiler.java:150)
I have checked the bundle 305 is active. Can anyone suggest why it is unable to create a backup and showing this error.
You seem to be dealing with filesystem-level permissions problem.
java.io.FileNotFoundException:
/home/ubuntu/AEM/Dev/(...)/check_html_jsp.java (Permission denied)
This error tells you that the AEM process was denied permission to access or save a file at the path provided.
Check which user started AEM and if the user has the permissions necessary to access the directory that you're trying to use (/home/ubuntu/AEM/Dev). Change the path or the permissions.

AppleMusicKit SDK / Sample Project - UserToken issue

I'm currently experimenting with the Adding-Content-to-Apple-Music code found here: https://developer.apple.com/musickit/
I'm using:
XCode 9 beta 2,
iOS 11 (iPhone 5s)
I have a developer token (which works when I query the Apple Music API searching songs etc...) but I now want to use this to exchange for a User Token so I can perform write actions against my Apple Music account.
The test app fires up and allows me to request authentication. From this I can see:
MPMedia Library - Authorized
SKCloudServicesController - Authorized
Capabilities:
Add to Cloud Music Library
Music Catalog Playback
My next obvious step is to use the developer token to gain the user token. However, as soon as I call the following:
cloudServiceController.requestUserToken(forDeveloperToken: developerToken, completionHandler: completionHandler)
i see the following error in the completionHandler - can anyone help?
2017-07-14 10:05:39.179300+0100 Adding-Content-to-Apple-Music[1326:172100] [MC] Reading from public effective user settings.
2017-07-14 10:05:40.635503+0100 Adding-Content-to-Apple-Music[1326:172299] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2017-07-14 10:05:40.636449+0100 Adding-Content-to-Apple-Music[1326:172100] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2017-07-14 10:05:40.800933+0100 Adding-Content-to-Apple-Music[1326:172297] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2017-07-14 10:05:40.801259+0100 Adding-Content-to-Apple-Music[1326:172299] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
An error occurred when requesting user token: The operation couldn’t be completed. (SKErrorDomain error 1.)
In Settings > iTunes & App Store on my device I am logged in with my Apple ID. Same goes for Apple Music too.
Update on this:
I also posted about this over on the Apple dev forums. It was an error on their side and now appears to be fixed. I can get a UserToken in both iOS 10 and 11 now.