Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Vending Machine App in Swift 2.0 Displaying Additional Views Controlling Custom Views

Will Van de Walle
Will Van de Walle
2,352 Points

How to present a modal view outside of a button?

I am trying to program a little game just to apply the concepts I learned in this course myself. When the game opens up, I would like for a custom modal view to tell the user how to play. Likewise, when they lose, I want to present a results page, which would be inside an if statement. I've searched all over the internet, and I can't find a way to display these views without an error. All that this video shows is how to show a display a view when a button is pressed; how do I display a custom modal view on command in code? (I am very new to Swift, so try to put it in layman's terms.) Thanks!

32 Answers

Harish Yerra
Harish Yerra
10,031 Points

Ok, so go to your App Delegate and put this code in the didFinishLaunchingWithOptions: Make sure to change the name of the segue to whatever you named it.

fun application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. let launchedBefore = NSUserDefaults.standardUserDefaults().boolForKey("launchedBefore") if !launchedBefore { self.window?.makeKeyAndVisible() self.window?.rootViewController?.performSegueWithIdentifier("myAwesomeSegue", sender: nil)//Put the name of your segue here. NSUserDefaults.standardUserDefaults().setBool(true, forKey: "launchedBefore") NSUserDefaults.standardUserDefaults().synchronize() } return true }

Will Van de Walle
Will Van de Walle
2,352 Points

It is still happening. Before or after return true?

Harish Yerra
Harish Yerra
10,031 Points

Oh and delete the code from your view controller. So remember the viewDidAppear code that we put in from StackOverFlow. Just delete that code.

Will Van de Walle
Will Van de Walle
2,352 Points

Yeah I tried that. Still not working.

Harish Yerra
Harish Yerra
10,031 Points

Ok, so if you deleted the viewDidAppear code. Is the view not presenting or is it just presenting multiple times?

Will Van de Walle
Will Van de Walle
2,352 Points

Well, now the view doesn't show up at all. Is this because I've technically opened the app before? How do I reset that?

Harish Yerra
Harish Yerra
10,031 Points

Yes, it's because you have opened the app before. So go to Simulator and do this Simulator -> Reset all Content and Settings. Then re run the app and hopefully it works :).

Harish Yerra
Harish Yerra
10,031 Points

Ok, so let's say I have two view controllers that I created in the storyboard (ViewControllerA, and ViewControllerB). Let's say I am on ViewControllerA and I want to programmatically present ViewControllerB. You can achieve this the following way. First go into your storyboard and zoom out as far as you can. Then click on ViewControllerB and go to the Identity Inspector. There should be an option which says "Storyboard ID". In my scenario I will give the Storyboard ID name "ViewControllerB" but feel free to name it whatever you want to.

Then in ViewController A use this code:

let vc = self.storyboard?.instantiateViewControllerWithIdentifier("ViewControllerB") as! ViewControllerB

self.presentViewController(vc, animated: true, completion: nil)

Obviously the names in your project might be a little different than ViewControllerA and ViewControllerB so you will just have to change the names to whatever you named them.

Will Van de Walle
Will Van de Walle
2,352 Points

Okay. Thanks a lot! I'll try it and let you know.

Harish Yerra
Harish Yerra
10,031 Points

Ok :). If there are any errors that come up just let me know and I will try to resolve them with you.

Will Van de Walle
Will Van de Walle
2,352 Points

What do I replace self.storyboard? with? I'm getting an error.

Harish Yerra
Harish Yerra
10,031 Points

Make your initial view controller ViewControllerB in your storyboard and see if it crashes or not. If it crashes that means that there is a connection issue.

Harish Yerra
Harish Yerra
10,031 Points

so yes in your case you would Ctrl+Drag the entire view. Also, just to simplify things. If you don't have many connections why don't you get rid of all of your connections and then re add them?

Will Van de Walle
Will Van de Walle
2,352 Points

With that specific view? I don't know what some of the connections are, and I can't delete that second one (the view -> Htp). Also, when I control drag from the entire view, it draws the blue line, but when I scroll over something, it doesn't say "Insert outlet" or whatever. It doesn't do anything.

Harish Yerra
Harish Yerra
10,031 Points

Is there any errors? Or is it just not presenting?

Will Van de Walle
Will Van de Walle
2,352 Points

Whoops. Just put it in the wrong spot; there was no self. :)

Harish Yerra
Harish Yerra
10,031 Points

Ah... ok :). Did it work? Depending on where you put it there might be issues....

Will Van de Walle
Will Van de Walle
2,352 Points

Oh dear. I got Thread 1: signal sigabrt. Darn. I don't know if that's with another object or this one, but I can check.

Harish Yerra
Harish Yerra
10,031 Points

Ya, that is an issue with the naming. Are you sure there isn't any naming issues?

Harish Yerra
Harish Yerra
10,031 Points

Did you put a name in the ID Inspector in main.storyboard?

Will Van de Walle
Will Van de Walle
2,352 Points

Isn't SIGABRT when there is an object with no connection?

Harish Yerra
Harish Yerra
10,031 Points

Ya, you can get SIGABRT with an object with no connection but you get that error in other instances too.

Will Van de Walle
Will Van de Walle
2,352 Points

I did put a name in for the ID. Do I put it in the storyboard I want to display (ViewControllerB) Or the main.storyboard?

Harish Yerra
Harish Yerra
10,031 Points

Are there multiple storyboards in your project or just one storyboard in your project? Also, you should zoom out fully when in the storyboard, and then click on the view and then add your ID in there.

Will Van de Walle
Will Van de Walle
2,352 Points

Whoops. I meant view controller. Do I put it in ViewControllerB or A? Also, does the zoom matter?

Harish Yerra
Harish Yerra
10,031 Points

Yes zoom does matter because otherwise you might not get the Storyboard ID option because you would be clicking on the view instead of the view controller. Also, put it in ViewController B (the one you want to go to programmatically).

P.S. I wish I could send pictures to explain.

Will Van de Walle
Will Van de Walle
2,352 Points

Agh. I zoomed out and corrected it but still got SIGABRT. On another note, so you aren't stuck here for hours, what would the code be if I wanted to put this in an if statement? There's no self, correct?

Harish Yerra
Harish Yerra
10,031 Points

The self should be there. Are you calling the if statement in your viewDidLoad?

Will Van de Walle
Will Van de Walle
2,352 Points

Is there a way I can post my entire project on here?

Harish Yerra
Harish Yerra
10,031 Points

Unfortunately not here :(. If you have github maybe you could post it on github and I could download it from there...

Will Van de Walle
Will Van de Walle
2,352 Points

Darn. I don't. And I have little to no idea really how to use GitHub. Could you throw out a few suggestions on the code though?

Harish Yerra
Harish Yerra
10,031 Points

Sure. Copy and paste the code in here and I will take a look at it.

Will Van de Walle
Will Van de Walle
2,352 Points

The Main View Controller:

import UIKit var numberValue = 0 let randomInt = getRandomNumber()

class ViewController: UIViewController { @IBOutlet weak var button: UIButton! @IBOutlet weak var buttonLabel: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    let htp = self.storyboard?.instantiateViewControllerWithIdentifier("HowToPlayView") as! HowToPlay
    self.presentViewController(htp, animated: true, completion: nil)
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

    // Dispose of any resources that can be recreated.
}


func updateButtonValue() {
    buttonLabel.text = "\(numberValue)"
}

@IBAction func buttonPressed() {
    numberValue += 1
    updateButtonValue()
}

}

Harish Yerra
Harish Yerra
10,031 Points

Don't see any errors in the code. Just confirming though "HowToPlayView" is the value of what you put inside the Storyboard ID and HowToPlay is the name of the view controller.. right?

Will Van de Walle
Will Van de Walle
2,352 Points

This may be important too: when I go to the connections for the HowToPlay view, I scroll over one and it says that there is no Htp outlet in HowToPlay

Harish Yerra
Harish Yerra
10,031 Points

No there shouldn't be any connections at all because this is just instantiating a view controller. You aren't really connecting it to anything in IB.

Harish Yerra
Harish Yerra
10,031 Points

So you are putting it in Storyboard ID not Restoration ID right

Harish Yerra
Harish Yerra
10,031 Points

Also, could you give me the full error that you see in the console? That may help narrow down the issue a bit..

Will Van de Walle
Will Van de Walle
2,352 Points

Yes. But what about the if statement?

Will Van de Walle
Will Van de Walle
2,352 Points

2016-05-22 16:05:21.753 Frustration[7973:307253] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Frustration.HowToPlay 0x7fef91427960> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key htp.' *** First throw call stack: ( 0 CoreFoundation 0x000000010fc08d85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001119acdeb objc_exception_throw + 48 2 CoreFoundation 0x000000010fc089c9 -[NSException raise] + 9 3 Foundation 0x000000010ffda19b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288 4 UIKit 0x00000001105c3d0c -[UIViewController setValue:forKey:] + 88 5 UIKit 0x00000001107fa7fb -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x000000010fb42890 -[NSArray makeObjectsPerformSelector:] + 224 7 UIKit 0x00000001107f91de -[UINib instantiateWithOwner:options:] + 1864 8 UIKit 0x00000001105ca8d6 -[UIViewController loadViewFromNibNamed:bundle:] + 381 9 UIKit 0x00000001105cb202 -[UIViewController loadView] + 178 10 UIKit 0x00000001105cb560 -[UIViewController loadViewIfRequired] + 138 11 UIKit 0x00000001105cbcd3 -[UIViewController view] + 27 12 UIKit 0x0000000110d97024 -[_UIFullscreenPresentationController _setPresentedViewController:] + 87 13 UIKit 0x000000011059b5ca -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133 14 UIKit 0x00000001105de5bb -[UIViewController _presentViewController:withAnimationController:completion:] + 4002 15 UIKit 0x00000001105e185c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489 16 UIKit 0x00000001105e136b -[UIViewController presentViewController:animated:completion:] + 179 17 Frustration 0x000000010fa1b83d _TFC11Frustration14ViewController11viewDidLoadfT_T + 669 18 Frustration 0x000000010fa1b9c2 TToFC11Frustration14ViewController11viewDidLoadfT_T + 34 19 UIKit 0x00000001105cb984 -[UIViewController loadViewIfRequired] + 1198 20 UIKit 0x00000001105cbcd3 -[UIViewController view] + 27 21 UIKit 0x00000001104a1fb4 -[UIWindow addRootViewControllerViewIfPossible] + 61 22 UIKit 0x00000001104a269d -[UIWindow _setHidden:forced:] + 282 23 UIKit 0x00000001104b4180 -[UIWindow makeKeyAndVisible] + 42 24 UIKit 0x0000000110428ed9 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131 25 UIKit 0x000000011042f568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769 26 UIKit 0x000000011042c714 -[UIApplication workspaceDidEndTransaction:] + 188 27 FrontBoardServices 0x000000011383d8c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 28 FrontBoardServices 0x000000011383d741 -[FBSSerialQueue performNext] + 178 29 FrontBoardServices 0x000000011383daca -[FBSSerialQueue _performNextFromRunLoopSource] + 45 30 CoreFoundation 0x000000010fb2e301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 31 CoreFoundation 0x000000010fb2422c __CFRunLoopDoSources0 + 556 32 CoreFoundation 0x000000010fb236e3 __CFRunLoopRun + 867 33 CoreFoundation 0x000000010fb230f8 CFRunLoopRunSpecific + 488 34 UIKit 0x000000011042bf21 -[UIApplication _run] + 402 35 UIKit 0x0000000110430f09 UIApplicationMain + 171 36 Frustration 0x000000010fa1e0d2 main + 114 37 libdyld.dylib 0x000000011247092d start + 1 38 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Harish Yerra
Harish Yerra
10,031 Points

Ah, are you sure ViewControllerB's class is correct? Zoom out all the way and click on ViewControllerB. Then make sure that ViewControllerB's class is set properly. It should be under Identity Inspector and there should be a Class field.

Harish Yerra
Harish Yerra
10,031 Points

Also, check to make sure your connections are properly set. There might be some @IBOutlets and @IBActions not properly set.

Will Van de Walle
Will Van de Walle
2,352 Points

How do I check that? And on what?

Will Van de Walle
Will Van de Walle
2,352 Points

Like what does it look like if they are not properly set?

Harish Yerra
Harish Yerra
10,031 Points

Check it on ViewControllerB. Also, one more thing why don't we try removing the "as! HowToPlay" from your code.

Harish Yerra
Harish Yerra
10,031 Points

If you check your connections. Improper connections won't look any different, but you might see duplicate connections in there so you might have to delete one.

Will Van de Walle
Will Van de Walle
2,352 Points

There is only one connection. Also, when I removed that, it had on the next line a correctable error. I took it's suggestion, adding ! after the htp, because it was not unwrapped. Still got the error.

Harish Yerra
Harish Yerra
10,031 Points

Then did you reconnect the connection?

Harish Yerra
Harish Yerra
10,031 Points

Ok, so get rid of the @IBOutlet that you removed in your ViewController and then create that IBOutlet again.

Will Van de Walle
Will Van de Walle
2,352 Points

I think I did that wrong. I deleted the one connection I had, and then what? Give me a step by step. I'm really new. I got a bad access eroor.

Harish Yerra
Harish Yerra
10,031 Points

Ok, so you go into your HowToPlay.swift file and then delete the IBOutlet that you disconnected. So just select the @IBOutlet and then just hit backspace. Then go back to your storyboard and then re add the connection again by using Ctrl + Drag.

Will Van de Walle
Will Van de Walle
2,352 Points

CTRL drag the entire viewcontroller?

Harish Yerra
Harish Yerra
10,031 Points

No just the IBOutlet that you deleted. So let's say that you removed a connection that was a button. Then you would Ctrl + Drag from the Button. What connection did you delete? Did you delete a button connection?

Will Van de Walle
Will Van de Walle
2,352 Points

No. It said: HTP -> htp And then there was one that said: view -> Htp

Harish Yerra
Harish Yerra
10,031 Points

Ya I am really confused as to what is going on with those connections. It's pretty hard to figure out what's going out without pictures or anything...

Maybe just redo the connections from scratch. So remove all of the connections from Interface Builder and from your View Controller. Then just re add all the connections that you deleted.

Will Van de Walle
Will Van de Walle
2,352 Points

Please help? Also what if inside if statement?

Harish Yerra
Harish Yerra
10,031 Points

It's really difficult to explain on this forum without having access to the project :(. Is there any way you could send the project to me? Do you have a StackOver Flow account. If you have a Stack OverFlow account you could ask it in there and include some pictures as to what's going on as well. Also, if you post it on stack over flow send me the link to your question so I could take a look at it.

Harish Yerra
Harish Yerra
10,031 Points

Sweet! You should be able to add pictures to your question. There is a picture button next to the code option. So when editing your question there is an option for bold, italics, etc. There should be an image option right next to the code button. We will continue this in StackOverFlow!

Will Van de Walle
Will Van de Walle
2,352 Points

I'd just like to say thank you so much. I am trying my best to learn Swift, and you have been an immense help. It is amazing that there are people like you who devote that much time to helping others. Thanks!!!!

Harish Yerra
Harish Yerra
10,031 Points

No problem :).

I remember learning Swift. It's a great language and I am happy to help :).

Will Van de Walle
Will Van de Walle
2,352 Points

Oh dear. The comments are disappearing on my screen.

Harish Yerra
Harish Yerra
10,031 Points

Ugh oh. Are they still disappearing?

Will Van de Walle
Will Van de Walle
2,352 Points

Yes. Just try to write something down all in one comment so we can keep it brief.

Harish Yerra
Harish Yerra
10,031 Points

Got it. So basically is the app giving any errors or is it not presenting at all?

Will Van de Walle
Will Van de Walle
2,352 Points

The view is not displaying, but there are no errors at all.

Harish Yerra
Harish Yerra
10,031 Points

Did you reset the simulator?

Harish Yerra
Harish Yerra
10,031 Points

Just to verify that your code is right could you paste in your entire AppDelegate's code?

Will Van de Walle
Will Van de Walle
2,352 Points

import UIKit

@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. 
        let launchedBefore = NSUserDefaults.standardUserDefaults().boolForKey("launchedBefore"); if !launchedBefore { self.window?.makeKeyAndVisible(); self.window?.rootViewController?.performSegueWithIdentifier("htpview", sender: nil)
            //Put the name of your segue here. 
            NSUserDefaults.standardUserDefaults().setBool(true, forKey: "launchedBefore"); NSUserDefaults.standardUserDefaults().synchronize() }; return true }
    return true
        }

func applicationWillResignActive(application: UIApplication) {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

}

Harish Yerra
Harish Yerra
10,031 Points
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        let launchedBefore = NSUserDefaults.standardUserDefaults().boolForKey("launchedBefore")
        if !launchedBefore {
            self.window?.makeKeyAndVisible()
            self.window?.rootViewController?.performSegueWithIdentifier("htpview", sender: nil)//Put the name of your segue here.
            NSUserDefaults.standardUserDefaults().setBool(true, forKey: "launchedBefore")
            NSUserDefaults.standardUserDefaults().synchronize()
        }
        return true
    }
Harish Yerra
Harish Yerra
10,031 Points

Paste in this code exactly and let's take a look at what happens. Also, make sure to reset the simulator!

Will Van de Walle
Will Van de Walle
2,352 Points

YAY IT WORKED!! Now for another thing that should take half the time. I have to do the same thing, but with an if statement/

Harish Yerra
Harish Yerra
10,031 Points

Awesome! So just describe what you are trying to accomplish with the if statement so I can get a sense of what you are trying to do.

Will Van de Walle
Will Van de Walle
2,352 Points

If a the button number is greater than the random number, then go to the results/losing page.

It's called frustration for a reason. ;)

Harish Yerra
Harish Yerra
10,031 Points

Alright so what you will want to do is create another segue that takes you to the results/losing page. And then create an if statement and within that if statement do the performSegueWithIdentifier("segueNameHere", nil).

Will Van de Walle
Will Van de Walle
2,352 Points

func check(){ if numberValue > randomInt { numberValue = 0 performSegueWithIdentifier("results", sender: nil) } }

I'm calling check() every time I click the button. It is returning SIGABRT.

Harish Yerra
Harish Yerra
10,031 Points

Which line is the error occurring on?

Will Van de Walle
Will Van de Walle
2,352 Points

SIGABRT always goes to the class line of App Delegate no matter what. The error is only occurring when I reach the number.

Harish Yerra
Harish Yerra
10,031 Points

Are you sure you created the segue properly and that the identifier is set to "results"?

Will Van de Walle
Will Van de Walle
2,352 Points

Yes. Code here: import UIKit var numberValue = 0 let randomInt = getRandomNumber()

class ViewController: UIViewController { @IBOutlet weak var buttonLabel: UILabel! @IBOutlet weak var button1: UIButton!

override func viewDidLoad() {
    super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
}



override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

    // Dispose of any resources that can be recreated.
}





@IBAction func buttonPressed() {
    numberValue += 1
    updateButtonValue(buttonLabel)
}

@IBAction func check() {
    if numberValue > randomInt {
        numberValue = 0
        performSegueWithIdentifier("results", sender: nil)
    }
}

}

Harish Yerra
Harish Yerra
10,031 Points

Hmmm... That code by itself looks correct. Could you copy and paste the full SIGABRT error?

Will Van de Walle
Will Van de Walle
2,352 Points

2016-05-22 20:49:52.110 Frustration[9697:398793] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<Frustration.ViewController: 0x7fd0c9cb8c40>) has no segue with identifier 'results'' *** First throw call stack: ( 0 CoreFoundation 0x0000000107889d85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010962ddeb objc_exception_throw + 48 2 UIKit 0x000000010824f6aa -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0 3 Frustration 0x000000010769b29c TFC11Frustration14ViewController5checkfT_T + 156 4 Frustration 0x000000010769b2e2 TToFC11Frustration14ViewController5checkfT_T + 34 5 UIKit 0x00000001080b3a8d -[UIApplication sendAction:to:from:forEvent:] + 92 6 UIKit 0x0000000108226e67 -[UIControl sendAction:to:forEvent:] + 67 7 UIKit 0x0000000108227143 -[UIControl _sendActionsForEvents:withEvent:] + 327 8 UIKit 0x0000000108226263 -[UIControl touchesEnded:withEvent:] + 601 9 UIKit 0x000000010812699f -[UIWindow _sendTouchesForEvent:] + 835 10 UIKit 0x00000001081276d4 -[UIWindow sendEvent:] + 865 11 UIKit 0x00000001080d2dc6 -[UIApplication sendEvent:] + 263 12 UIKit 0x00000001080ac553 _UIApplicationHandleEventQueue + 6660 13 CoreFoundation 0x00000001077af301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 14 CoreFoundation 0x00000001077a522c __CFRunLoopDoSources0 + 556 15 CoreFoundation 0x00000001077a46e3 __CFRunLoopRun + 867 16 CoreFoundation 0x00000001077a40f8 CFRunLoopRunSpecific + 488 17 GraphicsServices 0x000000010bf1fad2 GSEventRunModal + 161 18 UIKit 0x00000001080b1f09 UIApplicationMain + 171 19 Frustration 0x000000010769dff2 main + 114 20 libdyld.dylib 0x000000010a0f192d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Harish Yerra
Harish Yerra
10,031 Points

Ya, according to the error it's an issue with your segue in your storyboard. Hmm... the 90 minutes should be around over so go to StackOverFlow and ask a question there. Make sure to paste images of your segues so I can take a look at them.

Harish Yerra
Harish Yerra
10,031 Points

According to your pictures it looks like results is the StoryboardID of a view controller not a segue. Remember that previous little tutorial I made here: http://stackoverflow.com/questions/37380446/how-do-you-make-a-modal-view-appear-outside-of-a-controller .

Go to that and make a segue with the identifier "results". It should work then.

Will Van de Walle
Will Van de Walle
2,352 Points

It works! All of it!! Thank you so much! You are a hero!

Harish Yerra
Harish Yerra
10,031 Points

Amazing! Glad I could help :).

P.S. I would recommend you delete that last StackOverFlow Post that you made. People are starting to down vote it and you don't want to loose precious reputation (reputation is the point system in StackOverFlow).