Ed *_*ain 6 info.plist react-native
在运行时,有没有办法CFBundleVersion从Info.Plist 读取?
我想在应用程序的"关于框"中显示版本信息.
提前致谢,
-ed
G. *_*ide 15
我建议你使用这个做得很好的库
你会想到你需要的所有信息.
编辑
您还可以在AppDelegate.m文件中使用一些Obj-C.只需添加以下行:
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSDictionary *props = @{@"version" : version};
Run Code Online (Sandbox Code Playgroud)
并替换这些行:
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"NeedlIOS"
initialProperties:nil
launchOptions:launchOptions];
Run Code Online (Sandbox Code Playgroud)
用这些 :
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"NeedlIOS"
initialProperties:props
launchOptions:launchOptions];
Run Code Online (Sandbox Code Playgroud)
你在这里将版本作为道具传递给你的第一个iOS视图.这意味着您可以this.props.version在index.ios.js文件中使用应用程序版本.
| 归档时间: |
|
| 查看次数: |
4653 次 |
| 最近记录: |