<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">Unity 只带获取系统版本号接口:Application.version(),在PC和Android上都可以正常获取版本号,而在IOS上只能获取到Build号,所以需要通过Object获取 </span>
extern "C" {
void __getVersion(){
// app版本
NSString *ver = [[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleShortVersionString"];
NSString *build = [[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleVersion"];
NSString* version=[NSString stringWithFormat:@"%@.%@",ver,build];
version=[NSString stringWithFormat:@"{\"state\":\"Version\",\"version\":\"%@\"}",version];
NSLog(@"version:%@",version);
UnitySendMessage("PushManager","message",version.UTF8String);
}
}