FBSOpenApplicationErrorDomain error 1

IosXcodeIos SimulatorSwift2Xcode7

Ios Problem Overview


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.

Ios Solutions


Solution 1 - Ios

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.

Solution 2 - Ios

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 :)

Solution 3 - Ios

  1. Simulator->Reset Content and Settings
  2. Quit Simulator
  3. Run the test cases again

Solution 4 - Ios

In a tvOS app, you can go to simulator and delete the app in there and then re-run the program.

Solution 5 - Ios

If the other fixes don't work

Went through these attempts:

  1. Force quit the app in simulator
  2. reset simulator
  3. removed app from simulator
  4. Disabled App Transport Security globally (not recommended)
  5. Turned off all background modes issue always returned preventing debug sessions

This was my fix

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.

Solution 6 - Ios

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.

Solution 7 - Ios

Quitting(Command + Q) the simulator and launching it again solved the problem.

Solution 8 - Ios

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.

Solution 9 - Ios

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 .

Solution 10 - Ios

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.

Solution 11 - Ios

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.

Solution 12 - Ios

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.

EXPLANATION

App Transport Security

"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.

Solution

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 SDK

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.

  • Disable ATS from your app.
  • or Whitelist Facebook Servers for Network Requests.

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

Solution 13 - Ios

Try resetting your simulator

sudo rm -rf /private/tmp/com.apple.CoreSimulator.SimDevice.*

Solution 14 - Ios

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.

Solution 15 - Ios

I was trying to run Detox with a React Native app and the Detox Getting Started guide recommended this command:

Very Bad Build 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.

Bad Build Command:
$ xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -derivedDataPath ios/build
Good Build Command:
$ xcodebuild -workspace ios/MyApp.xcworkspace -configuration Debug -scheme MyApp -destination 'platform=iOS Simulator,name=iPad (6th generation)' -derivedDataPath ios/build

Solution 16 - Ios

I got this issue after migrating from an Intel Mac to an M1 using Migration Assistant. I solved it by reinstalling Xcode.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDouglas FerreiraView Question on Stackoverflow
Solution 1 - IosDenisView Answer on Stackoverflow
Solution 2 - Iosi Code 4 FoodView Answer on Stackoverflow
Solution 3 - IoswebcpuView Answer on Stackoverflow
Solution 4 - IosNRRView Answer on Stackoverflow
Solution 5 - IosdamoteView Answer on Stackoverflow
Solution 6 - IosOhad SchneiderView Answer on Stackoverflow
Solution 7 - IosKhurram ShehzadView Answer on Stackoverflow
Solution 8 - IosPKCLsoftView Answer on Stackoverflow
Solution 9 - IosGarryView Answer on Stackoverflow
Solution 10 - IosMunir MehtaView Answer on Stackoverflow
Solution 11 - IosBarney SzaboView Answer on Stackoverflow
Solution 12 - IosAPesateView Answer on Stackoverflow
Solution 13 - IosDaisy R.View Answer on Stackoverflow
Solution 14 - IosJeson MartajayaView Answer on Stackoverflow
Solution 15 - IosPaulMestView Answer on Stackoverflow
Solution 16 - IossmileBotView Answer on Stackoverflow