It is just report a problem and solution when I make a new single view app project on XCode11 with disabling ARC.
Problem:
First, I make a new project as Single View App on XCode11 with disabling ARC. And then I build and run it, the app is crashed.
About Error:
XCode11 makes a default "main.m" like below.
The error will be occured in "return UIApplicationMain(argc, argv, nil, appDelegateClassName);" line.
int main(int argc, char * argv[]) {
NSString * appDelegateClassName;
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
return UIApplicationMain(argc, argv, nil, appDelegateClassName); // Error Occured.
}
Solution:
I could resolve the problem when I put the "main.m" that made by XCode10, instead of XCode11.
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
I'm not sure why Apple put the return code out of @autoreleasepoo {}.
And also we need to set UIWindow property like below when we don't use SwiftUI.
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end