iOS 13: Swift – ‘Set application root view controller programmatically’ does not work
To choose a previous approach to the one supported by SwiftUI, from a project created in Xcode 11, you can follow these steps.
To choose a previous approach to the one supported by SwiftUI, from a project created in Xcode 11, you can follow these steps.
You can access the delegate like this: MainClass *appDelegate = (MainClass *)[[UIApplication sharedApplication] delegate]; Replace MainClass with the name of your application class. Then, provided you have a property for the other view controller, you can call something like: [appDelegate.viewController someMethod];
NOTE: The below solution no longer works on iOS 13+ devices – it will return garbage data. Please use following code instead: + (NSString *)hexadecimalStringFromData:(NSData *)data { NSUInteger dataLength = data.length; if (dataLength == 0) { return nil; } const unsigned char *dataBuffer = (const unsigned char *)data.bytes; NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; … Read more
This error can occur when you rename files outside of XCode. To solve it you can just remove the files from your project (Right Click – Delete and “Remove Reference”). Then after you can re-import the files in your project and everything will be OK.
You have to set ViewController StoryBoardId property as below image. open viewController using coding as below in swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: “Main”, bundle: nil) let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewControllerWithIdentifier(“Circles”) as UIViewController self.window = UIWindow(frame: UIScreen.main.bounds) self.window?.rootViewController = initialViewControlleripad self.window?.makeKeyAndVisible() return true … Read more