Ios 原生开发笔记

782 阅读1分钟
本文是ios开发的学习及开发笔记 不定时更新 一个没入门的ios小白

  1. 关于window
    在使用singleview方式来创建项目的时候,发现 仅能在appdelegate.m中使用self.window.rootViewController是指根控制器,然后使用[self.window makeKeyAndVisible]; 将窗口显示出来
    关于 info.plist的 字典 Main storyboard file base name 这里当设置为空时,有时候会黑屏 即便[self.window makeKeyAndVisible]; 将指定的根控制器显示出来。
  2. 自定义启动文件
    今天看 apicloud的模块开发代码,发现他讲默认的appdelegate 进行了自定义
    #import <UIKit/UIKit.h>
    int main(int argc, char * argv[]) {
            @autoreleasepool {
                    return UIApplicationMain(argc, argv, nil, @"UZAppDelegate");
            }
    }


    对比  xcode 10 默认生成的main.m文件  
  #import <UIKit/UIKit.h>
    #import "AppDelegate.h"
    int main(int argc, char * argv[]) {
            @autoreleasepool {
                    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
            }
    }


    我们可以看出来  `NSStringFromClass([AppDelegate class])`其实就是`@"AppDelegate"` 也就是 指定启动文件了。
  1. 关于打包静态库
    注意因为终端的shell显示设置 下面的➜ Products ➜Release-iphonesimulator➜ Release-iphoneos是指的编译成功后 liblaunchModel.a所在的相关目录
        ➜  Products lipo -create Release-iphoneos/liblaunchModule.a Release-iphonesimulator/liblaunchModule_simulator.a -output liblaunchModule.a
        ➜  Products lipo -info liblaunchModule.a
        Architectures in the fat file: liblaunchModule.a are: x86_64 arm64
        

需要使用命令将模拟器和真机进行处理 不然 只能通过lipo -info liblaunchModule.a得到以下两种之一

            ➜  Release-iphonesimulator lipo -info liblaunchModule.a
         Non-fat file: liblaunchModule.a is architecture: x86_64
         ➜  Release-iphoneos lipo -info liblaunchModule.a
         Non-fat file: liblaunchModule.a is architecture: arm64
  1. apicloud更改widget目录
         APIConfiguration *configuration = [[APIConfiguration alloc] init];
         configuration.defaultWidgetPath = [NSString stringWithFormat:@"%@/%@/", [NSBundle mainBundle].bundlePath, @"appfile" ];
  1. 其他

使用openwrite发布