Safari extension builded with Xcode, disappears from Safari after rebuild - xcode

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!

Related

xcode-cloud-assertion failures when testing Xcode Source Editor Extension

So I have a bare-bones Xcode project with an Xcode Source Editor Extension target attached. I'd like to test the thing, so I hit run. A new instance of Xcode pops up, where my extension should appear in the Editor menu, but there's nothing there. The logs show the following lines (among other things):
2023-01-20 13:44:24.240562-0800 Xcode[2203:46831] [xcode-cloud-assertion] ❌❌❌ Assertion failure #0 in Failed SW AuthKit for: <private>
2023-01-20 13:44:24.249980-0800 Xcode[2203:46831] [xcode-cloud-assertion] ❌❌❌ Assertion failure #0 in Failed to authenticate account: <private> error: <private>
For context, I'm running the following:
macOS 12.6.2
MacBook Pro (Retina, 13-inch, Early 2015)
Xcode 14.0 (14A309)
I'm not enrolled in the Apple Developer Program, and I've never used Xcode Cloud.
It's also worth noting that when I go to Reports > Cloud, I get Analyzing workspace... for a few minutes before Could not load Xcode Cloud data pops up (same issue as described here). I get similar behavior across all projects, including brand new ones. I'm not sure if that has anything to do with these log messages above, but I kind of hope it does.
I've tried the following:
Removing and adding my Apple ID in Xcode, restarting my MacBook in between
Deleting my development certificates
The main thing is that I'd like to be able to test my source editor extension. Any ideas?
Found it. The problem is XcodeKit, which isn't set to sign out of the box. I was able to fix it by setting it to Embed & Sign under General > Frameworks and Libraries > XcodeKit.framework (see screenshot).

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

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

Brand new Xcode unit test target cannot run because "Launch session expired before checking in."

I have added a brand new unit test target to my macOS app project in Xcode. It contains the default two files:
(name of target).swift
Info.plist
However when I run my test suite, this brand new target breaks with the error "Test operation failure: Launch session expired before checking in."
The full log is:
12:12:49.492 Xcode[10034:721978] Beginning test session MyTargetTests-3902F95F-20F9-4E6C-94EE-0BF8660D3B5A at 2017-06-18 12:12:49.492 with Xcode 8E3004b on target <DVTLocalComputer: 0x7fcc3cf024d0 (My Mac | x86_64)> (10.12.4 (16E195))
12:12:49.492 Xcode[10034:721978] Launching with Xcode.DebuggerFoundation.Launcher.LLDB
12:12:49.492 Xcode[10034:894962] Waiting for connection to unix domain socket at /tmp/XCTest-QcErkZ.
12:12:59.747 Xcode[10034:721978] Launch session started.
12:12:59.832 Xcode[10034:721978] Adding console adaptor <IDEConsoleAdaptor: 0x7fcc2cd44d00 'target'> for test session 3902F95F-20F9-4E6C-94EE-0BF8660D3B5A.
12:12:59.914 Xcode[10034:721978] Test process runnable PID is 19198.
12:13:02.025 Xcode[10034:721978] Test operation failure: Launch session expired before checking in.
12:13:02.025 Xcode[10034:721978] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Launch session expired before checking in." UserInfo={NSLocalizedDescription=Launch session expired before checking in.} didCancel: 1
My setup is:
Mac Mini mid 2011
macOS 10.12.4
Xcode 8.3 (tried with Xcode 8 too - no good)
I have tried:
sudo /usr/sbin/DevToolsSecurity --enable - no good
Deleting and recreating the test target - no good
Upgrading Xcode to 8.3 - no good
Running the target's tests just by themselves - no good, no extra logs either
So... How do I make the unit test target work?
The error message "launch session expired before checking in" is a bit of a red herring. You need to expose the real underlying error message, which you can access via View -> Debug Area -> Show Debug Area (if it is not already showing).
In my case, the problem was that libswiftswiftononesupport.dylib was not being linked to certain libraries of my own in my macOS app (dyld image not found). The solution was a bit weird, and laborious, but it does work:
I replaced all my dynamic library targets with framework targets
I enabled "Always Embed Swift Standard Libraries" in the framework targets
I did not embed the frameworks in any host application - I chose 'none' for this option.
I recently came across that failure when I wanted to implement automated screenshots with fastlane. In my case the error occurred because the freshly created UITest target was set up with a deployment target of iOS 11.X and therefore no 32 Bit version was build for iPhone 4s. (The Apps deployment target is 9.3).

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.

Unable to find APP_BUNDLE_PATH. Cannot find a built app that is linked with calabash.framework

I am running calabash-cucumber in xcode 5.0.1 on OSX 10.9.1, but getting this error while executing the test script. I have installed calabash framework successfully, but don't know why this error occurs.
Error... Unable to find APP_BUNDLE_PATH.
Cannot find a built app that is linked with calabash.framework
Please build your app from Xcode
You should build your calabash target.
Alternatively, specify APP_BUNDLE_PATH in features/support/01_launch.rb
This should point to the location of your built app linked with calabash.
(RuntimeError)
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.9.168/lib/calabash-cucumber/launch/simulator_helper.rb:178:in `app_bundle_or_raise'
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.9.168/lib/calabash-cucumber/launcher.rb:307:in `relaunch'
/Users/mymac/Desktop/myproject/myproj/features/support/01_launch.rb:29:in `Before'
Does your simulator or device contain the YourApp-cal target installed? Check weather you run the YourApp-cal target once from the xcode to install the app with calabash server on simulator or device.
Then Check you have followed setup Process
You need to have xcode tools installed too.
Check these things too.
Build the yourApp-cal target and run using xcode once.
While App is running open a Terminal(console) and type calabash-ios console. If your ruby environment is correct it will open you a ruby console.
In that console type
server_version['version']
and
Calabash::Cucumber::FRAMEWORK_VERSION
you should get something like "0.9.164"
calabash.framework is installed correctly in your app.
If so You should go to the file /YourProject/features/support/01_launch.rb open it check weather app bundle path is specified or not (if it is commented out calabash automatically detect the default app bundle path) if you are building your app to somewhere else than the default place you need to specify the appbundle path here in this file.
Tell us more details after check this list so we can help you more..
I hit the same issue, the way I got around to it is, on Xcode's top-right corner there is "Identity and Type" window. There you will find the full path of anything that you select on left (Project Explorer window).
Now usually on the ProjectExplorer window you should have "Classes", "Common", "Frameworks", "Other Sources", "Product", "Resources", "Scripts" etc. (It might be slightly different project by project). Inside "Product" is where your .app lives.
Select your app and you'll see the whole path on "Identity and Type" window.
Copy and paste it to "support/launch.rb" where it says APP_BUNDLE_PATH.
Should work now.
Edit 29/07/14: Do you see
HTTPServer: Started HTTP server on port 37265 on 'All output' window of Xcode (my version of Xcode is 5.1) when you build ?
There is a better way to set up calabash so you won't have this problem.
It involves creating a configuration, rather than a -calabash target. Basically you
1. create a configuration
2. add calabash framework to that configuration in build settings
3. add framework search path to find that framework
4. create a scheme to run calabash
The longer version can be found
http://fangmobile.com/2014/05/08/do-you-love-calabash-ios-but-hate-that-cal-second-target/
Deleting the contents of /Library/Developer/Xcode/DerivedData and compiling again solved this problem for me.
My error message was Unable to auto detect APP_BUNDLE_PATH.

Resources