0

I have been using .storyboard file and corresponding .h and .m files to show a simple barcode scanner in my application.

What is the issue behind this?

User1075
  • 819
  • 15
  • 36
  • Pay close attention to the error message: your `AppDelegate` class does not have a `setWindow` method - why? – Gereon Feb 29 '20 at 20:06
  • Does this answer your question? [How to launch new project without a storyboard >= iOS 13 in Xcode 11?](https://stackoverflow.com/questions/58655903/how-to-launch-new-project-without-a-storyboard-ios-13-in-xcode-11) – Cy-4AH Mar 03 '20 at 09:23
  • Could you also show `AppDelegate.h` – Cy-4AH Mar 03 '20 at 09:24

2 Answers2

1

try creating new reference from UIWindow.

`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CGRect windowFrame = UIScreen.mainScreen.bounds;
UIWindow *theWindow = [[UIWindow alloc] initWithFrame:windowFrame];
UIViewController *viewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
theWindow.rootViewController = viewController;
[self setWindow:theWindow];
return YES;

}

abanoub nabil
  • 81
  • 1
  • 4
0

I think you should use SceneDelegate class

@implementation SceneDelegate

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {

self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
UIViewController *vc = [[UIViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
}