iOS项目集成RN

参考官方文档

https://reactnative.cn/docs/integration-with-existing-apps/

1. podfile编写参考文档

2. 添加 App Transport Security 例外

3. 运行packager

崩溃:

在appdelegate中集成window

集成代码

    NSURL *jsCodeLocation;
    jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.bundle?platform=ios&dev=true"];
    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                        moduleName:@"LunaClient"
                                                 initialProperties:nil
                                                     launchOptions:nil];
    rootView.frame = CGRectMake(0, 64, 300, 300);
    [self.view addSubview:rootView]; 

 

报错:RCTStatusBarManager module requires that the UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO

https://www.jianshu.com/p/2fbc9329bb43?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

在info.plist中,add row添加View controller-based status bar appearance并设置为NO即可

 

参考文档:https://www.cnblogs.com/richard-youth/p/9724870.html

你可能感兴趣的:(iOS)