9

After upgrading Xcode from 5 to 6 beta, almost every project gives me an unexpected error after running the application. There are some other posts with this title but the error is different.

In AppDelegate.swift, sometimes the simulator goes completely black, without the error, sometimes it gives me the error on this line:

class AppDelegate: UIResponder, UIApplicationDelegate { 

In Xcode 5 I didn't had this error before, with Deployment Target set to 7.0 or 7.1.

Thanks in advance.

3
  • 3
    Xcode 6 is beta. it has some serious bugs. wait for the release Jun 13, 2014 at 11:35
  • @Anil I know, but that means I can't „play” with Swift apps until the official release. Which sucks. Or maybe they changed something and I don't know yet.
    – perte
    Jun 13, 2014 at 11:37
  • 1
    You should have 2 applications, upgrading from 5 to 6 beta was bad decision. Delete app and reinstall it from member center
    – B.S.
    Jun 13, 2014 at 11:39

7 Answers 7

8

This error is caused when you have 2 or more of the same IBOutlets or IBActions in your main.storyboard inspector (right arrow key at the very end of your options). Find out where there is double, and delete the one you don't need! It should work perfectly fine after that.

2
  • This fixed my issue thanks. In my case, I had accidentally control-dragged my button and created and named an IBOutlet. I deleted the IBOutlet code in the ViewController and then control-dragged my button and created and named an IBAction. The storyboard, however, still had the old reference to the IBOutlet property with the same name as the IBAction method, causing this error.
    – Andi
    Feb 23, 2018 at 16:39
  • Double doesn't matter, mismatching between IB and source code does. Say you have control-drag a label from IB to source code, then delete @IBOutlet weak var aLabel: UILabel! in source code, the error will arise Jul 15, 2019 at 8:24
3

Seems like there was a bug with iOS 7.1 as target.

Running tests on devices with iOS 7.1 installed now works. (17028705)

Try it again with the beta 2 update

0
2

I found this issue happened when I linked @IBOutlet/@IBAction and the linkage broke (renaming for instance). In the main.storyboard inspector, right click (control click) on the elements and delete any bad linkages. Should fix the error if that's the issue.

(Xcode 7)

1

fix my problem:

  1. Go to deployment info and in "Main interface" select your correct storyboard...
  2. Rerun app.
0

My issues with this started after I installed the legacy simulators (iOS7.1) under 'More Simulators' under the simulator build target. Xcode 6 and its native simulator had been running fine until then. What fixed it for me was to close Xcode, delete Derived Data, and under iOS Simulator in the simulator application choose "Reset Content and Settings" then restart the system.

2
  • Thanks for this. I'll definitively try this too.
    – perte
    Sep 22, 2014 at 14:54
  • @Catherine what if you are running on an actual device?
    – MoralCode
    Jan 23, 2015 at 2:04
0

I'm new to the coding world but resolved the painstacking problem. I was getting the same error by doing something and even though i deleted everything around that i couldn't resolve it. It was still giving me the same error, which meant that it is not deleting in some file it stores. Took me a while to figure out which file, finally when i opened the Mainstoryboard as source file, and did search on the error key word which i knew i changed, it gave me the lines it was sitting in. After deleting those lines error got fixed. I know basic HTML so i knew which lines to delete.

I cannot start my project all over again everytime i have this error so i had to find the solution and there was no solution i could find. So i had to do it myself with common sense, as i said i have no knowledge of coding.

Hope it helps.

0

I know there's already plenty of answers but just to note what happened in my case:

I created the ViewController on the storyboard first and then I created the class, I don't know why this was an error because both class names where identical, but by rewriting the class name on the storyboard helped to "link" correctly the view controller and its file. First create file then ViewController on storyboard to prevent this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.