Oguz Özkeroglu
Oguz Özkeroglu

Reputation: 3057

Why my iOS app fails / closes when I open it from iOS simulator?

I am developing a small Swift application. In Xcode, when I press run button or use cmd + R keyboard shortcut, simulator and my app runs as I expected. But in simulator, when I click my installed app's icon to run it my app appears for one second and crashes / fails with no error message or no log.

I'm new to iOS development and don't know is this a common issue or where I do wrong.

I've reset simulator content and settings by iOS Simulator Menu -> Reset Content and Settings... option.

I've restarted iOS simulator, Xcode and operating system (OS X) but the problem still existing.

I basically want to click my installed app's icon in simulator and run it. How can I fix this issue?

--

Edit due comments:

I don't touch AppDelegate.swift file. It is same as first generated. And I have only one ViewController class, ViewController.swift and methods are:

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

    override func viewWillAppear(animated: Bool) {
        login()
    }

    /// Login method
    func login() {
       // login methos's body
    }

Upvotes: 3

Views: 2429

Answers (1)

Oguz Özkeroglu
Oguz Özkeroglu

Reputation: 3057

Ok, I've got solution. Thanks to @Phillip Mills for his comment. That comment helps me to find solution.

In System Log Queries, I found the report crash, like as follow:

Dyld Error Message:

 Library not loaded: @rpath/Alamofire.framework/Alamofire
  Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/79ECB6DD-8AF9-42F7-8543-AF9F689258C0/data/Containers/Bundle/Application/126E829F-A5D3-48CE-B65A-C06CE811A679/MyAwesoneApp.app/MyAwesoneApp
  Reason: image not found

And googled it, than found this issue from github: dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire on my iPhone(iOS8) while debuging #101

I tried that I saw from screen shot and it works!

I forgot to add Alamofire framework to Link Binary With Libraries part.

Upvotes: 3

Related Questions