Reputation: 2279
I'm trying to run my iOS app that was migrated from Swift 1.2
to Swift 2.0
in Xcode 7 using iPhone Simulator (any), I'm getting the following error:
The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)
I already tried to reset simulator settings and content, quit Xcode, clean project, etc.
Upvotes: 53
Views: 27911
Reputation: 19642
I got this issue after migrating from an Intel Mac to an M1 using Migration Assistant. I solved it by reinstalling Xcode.
Upvotes: 0
Reputation: 14985
I was trying to run Detox with a React Native app and the Detox Getting Started guide recommended this command:
$ xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build
... which had all sorts of failures on Xcode Version 10.2.1 (10E1001)
So I changed the command until it built successfully. However, I was (unknowingly) building for the incorrect platform. My xcodebuild
was generating Debug-iphoneos
and not Debug-iphonesimulator
. So even though xcodebuild
would report success, whenever I copied the app over to the simulator and tried to execute it, it would fail with:
$ xcrun simctl launch 35CC1D95-CDC2-4C8F-9B68-8E13EF7127D8 com.mycompany.iosapp
com.mycompany.iosapp: -1
An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "com.mycompany.iosapp" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: Unspecified.
Underlying error (domain=FBSOpenApplicationErrorDomain, code=1):
The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)
So the fix was to change by build command to build for the correct platform.
$ xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -derivedDataPath ios/build
$ xcodebuild -workspace ios/MyApp.xcworkspace -configuration Debug -scheme MyApp -destination 'platform=iOS Simulator,name=iPad (6th generation)' -derivedDataPath ios/build
Upvotes: 0
Reputation: 7352
Following up the accepted answer from Denis, the impossible places
he mentioned is first discovered from Simulator System Log. (Mac XCode Simulator > Debug > Open System Log..)
In my case, I am trying to debug a hello world Xamarin Forms to simulator iPad 2 iOS 9.3
. VS2017Mac outputs the error above, but Simulator System Log gives more information
Program specified by service does not contain one of the requested architectures: XPC_FLAGS=0x0
As mentioned in this thread, I need to right-click on iOS project and modify Build > iOS Build > Supported architectures
to i386 + x86_64
. This makes sense since pre-IOS 11 Apple supports both 32-bit and 64-bit app.
Also, refreshing the simulator helps too. (Simulator > Hardware > Erase All Content and Settings..). This ensures the app deployed to simulator contains the latest change.
Upvotes: 0
Reputation: 633
Try resetting your simulator
sudo rm -rf /private/tmp/com.apple.CoreSimulator.SimDevice.*
Upvotes: 0
Reputation: 11
I got this error using Xamarin iOS, Visual Studio for Mac 7.2, compiling for iPad 2, iOS 9.3. The solution was to change the iOS build's supported architectures to i386 + x86_64, under Project -> Options -> iOS Build -> Supported Architectures.
Upvotes: 1
Reputation: 1010
Quitting(Command + Q) the simulator and launching it again solved the problem.
Upvotes: 3
Reputation: 38116
In my case I was able to resolve it by using a different simulator. It consistently happened with the iPhone 4S
simulator, but once I switched to the iPhone 6 Plus
simulator, the error was gone.
Upvotes: 4
Reputation: 78
After lot of struggling, i think the issue is you might be trying to run the app which is running in the background. Stopping the app from xcode doesn't actually stop it (Strange right), you have to press home key which is cmd+shift+h twice, find your app and kill it. I am still trying to figure out better way of doing this as this is tedious, but at least this will work temporarily.
Upvotes: 1
Reputation: 779
Went through these attempts:
Seems like the schemes manager enables a field with no arguments that caused my issue.
Product menu > Scheme > Edit Scheme > Run > Arguments > Environment Variables
If there is a checkmark there with an empty field next to it, then uncheck it.
I was getting the "1" error code. I hope this works for you too.
Upvotes: 6
Reputation: 2154
This error happens when a previous run of the app is still alive in the background, even if you clicked "Stop" in Xcode. Try manually killing the app in simulator itself: cmd+shift+H twice to open up running apps, drag up your app to kill it. Note cmd+shift+H is the shortcut to go to homescreen. Then start the new run and it should work fine :)
Upvotes: 22
Reputation: 1041
In a tvOS app, you can go to simulator and delete the app in there and then re-run the program.
Upvotes: 6
Reputation: 3422
Upvotes: 8
Reputation: 100
I'm pretty sure that this problem may be related to the ATS on iOS 9.
Make sure you have followed the steps provided by the FB team in order to get their SDK working on iOS 9. Release Notes.
"App Transport Security is a feature that improves the security of connections between an app and web services. The feature consists of default connection requirements that conform to best practices for secure connections. Apps can override this default behaviour and turn off transport security."
"All connections using the NSURLConnection, CFURL, or NSURLSession APIs use App Transport Security default behaviour in apps built for iOS 9.0 or later, and OS X v10.11 or later. Connections that do not follow the requirements will fail."
Source: Apple - App Transport Security Technote
This means that if you attempt to perform a connection on an app built for iOS 9.0 or later, or OS X v10.11 or later, and that connection doesn't conform to the requirements of ATS, the connection will fail.
There are two solutions for this problem.
Recommended
Make sure your connections meet the requirements imposed by ATS.
"Temporary Solution"
Disable the ATS on your app to allow connections that doesn't conform to this.
This may be a temporary solution because as you may now disable the ATS from being used in your app, in future releases this option may be removed and you will be forced to use ATS as a default security feature.
Facebook in order to win some time and allow their user to continue using their SDK in iOS 9.0 and OS X 10.11. They picked the "Temporary Solution" and because of that you have to.
To do the later you must add the following to your target .plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
Also you may need to perform other changes If you use any of the Facebook dialogs (e.g., Login, Share, App Invites, etc.) that can perform an app switch to Facebook apps.
Source: Facebook - Preparing Your Apps for iOS9
Upvotes: 0
Reputation: 407
In my case i solve it as .
Just dismiss the app on which you are working if running on background mode.
it works for me & hope it works for you .
Upvotes: 1
Reputation: 1358
This error isn't (I believe) anything to do with a Facebook SDK. I'm getting this and I have no Facebook SDK at all.
What I found is that although Xcode shows no reasons for the error, was that the simulator log does.
When you get this error, the simulator will be running, so swap to it, and then from the "Debug" menu, select "Open system log...".
Once the log is on screen, traverse to it's end and you should see a lot more information (including a stack trace if you're lucky) about what went wrong.
In my case it was an exception being thrown because a file asset was missing, or couldn't be found.
Upvotes: 2
Reputation: 6413
I had the same error after updating Xcode to v7.0. After few hours struggling, I found that there was some empty environment variable setup to be passed for Run action in my active scheme (have no idea why it was there). Removing this empty environment variable resolved the issue immediately.
Upvotes: 56