1、新建工程。
2、更改入口
2.1、删除SceneDelegate.h 及.m文件
2.2、在AppDelegate.h 添加 @property (strong, nonatomic) UIWindow * window;属性
2.3、移除AppDelegate文件中UIScene代理
2.4、在info.plist文件中移除Application Scene Manifest
3、设置进入的页面。
在application:(UIApplication *)application didFinishLaunchingWithOptions代理中,加入代码
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = self.launchViewController;
[self.window makeKeyAndVisible];
4、如果需要将AppDelegated及其他文件整理放在单独的文件夹中
4.1、在本地项目目录下,创新创建AppEnters(或其他名称)的文件夹。
4.2、将AppDelegate、info.plist、main.m文件移入
5、此时运行项目, 会报错multiple commands produce xxxxx info.plist
意思,info.plist重复了。需要在Targets - build phases 中,的Copy bundle Resouurces 中删掉info.plist
6、由于4中更改了info.plist的路径,此时运行,会报错Build input file cannot be found ‘xxxx info.plist’
找不到文件。此时需要将新的路径重新设置一下。Targets - bulid settings - packaging 中有个info.plist File选项。它的值是之前的路径,需要改成新的路径如:testApp/AppEnters/Info.plist
到此,可以成功运行。
7、给工程加pod。
先cd到项目目录下,pod init。会创建Podfile 文件,在文件中,加入需要的三方库。然后pod install。
运行后,如果出现Sandbox :rsync.samba xxxxx的报错,则需要Targets - build Settings - 搜索user script sandboxing 设置成NO,就可以了。