construct – Black Display whereas Constructing App on iOS Simulator Xcode 14.3.1


I’m making an attempt to construct my app on Xcode however each time I attempt to I get a black display screen. I already reviewed the ViewController, App Delegate and DetailViewController, every of those information appear to be appropriate. I additionally tried constructing my app with an older model of iOS being iOS 15.5 however this course of was not profitable and eventually simply to verify all the things was appropriate in my code additionally tried eradicating sure components (the most recent code added) of my ViewController but it surely would not construct the app nonetheless. Has this occurred to anybody of you?

I am new to this programming and full ecosystem during which I am working with, additionally my first put up right here. 😀

What it ought to occur:
It ought to present a desk with photos but it surely will not, simply exhibits a plain black display screen of the app.

I’m utilizing:
Mac OS 13.4
Xcode 14.3.1

That is my ViewController:

import UIKit

class ViewController: UIViewController {
    var photos = [String]()
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        
        let fm = FileManager.default
        let path = Bundle.essential.resourcePath!
        let objects = attempt! fm.contentsOfDirectory(atPath: path)
        
        for merchandise in objects {
            if merchandise.hasPrefix("nssl") {
                photos.append(merchandise)
            }
            
        }
        print(photos)
    }
    
 }



That is my DetailViewController:

import UIKit

class DetailViewController: UIViewController {
    @IBOutlet var imageView: UIImageView!
    var selectedImage: String?

    override func viewDidLoad() {
        tremendous.viewDidLoad()

        title = selectedImage
        navigationItem.largeTitleDisplayMode = .by no means

        if let imageToLoad = selectedImage {
            imageView.picture  = UIImage(named: imageToLoad)
        }
    }

    override func viewWillAppear(_ animated: Bool) {
        tremendous.viewWillAppear(animated)
        navigationController?.hidesBarsOnTap = true
    }

    override func viewWillDisappear(_ animated: Bool) {
        tremendous.viewWillDisappear(animated)
        navigationController?.hidesBarsOnTap = false
    }
}

That is my AppDelegate:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func software(_ software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        // Override level for personalisation after software launch.
        return true
    }

    func applicationWillResignActive(_ software: UIApplication) {
        // Despatched when the appliance is about to maneuver from lively to inactive state. This will happen for sure varieties of non permanent interruptions (resembling an incoming telephone name or SMS message) or when the consumer quits the appliance and it begins the transition to the background state.
        // Use this technique to pause ongoing duties, disable timers, and invalidate graphics rendering callbacks. Video games ought to use this technique to pause the sport.
    }

    func applicationDidEnterBackground(_ software: UIApplication) {
        // Use this technique to launch shared assets, save consumer information, invalidate timers, and retailer sufficient software state data to revive your software to its present state in case it's terminated later.
        // In case your software helps background execution, this technique is known as as a substitute of applicationWillTerminate: when the consumer quits.
    }

    func applicationWillEnterForeground(_ software: UIApplication) {
        // Referred to as as a part of the transition from the background to the lively state; right here you possibly can undo most of the modifications made on coming into the background.
    }

    func applicationDidBecomeActive(_ software: UIApplication) {
        // Restart any duties that have been paused (or not but began) whereas the appliance was inactive. If the appliance was beforehand within the background, optionally refresh the consumer interface.
    }

    func applicationWillTerminate(_ software: UIApplication) {
        // Referred to as when the appliance is about to terminate. Save information if acceptable. See additionally applicationDidEnterBackground:.
    }


}


Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles