获取iOS应用程序版本Corona SDK
问题描述:
我正在使用iOS应用程序,需要访问应用程序版本号。 我知道它更简单的Objecitve-C + Xcode通过访问Info.plist 但我想在Corona SDK中使用此功能。这可能吗?如果是,那么如何? 请帮忙,因为我卡在这里,不能前进。获取iOS应用程序版本Corona SDK
答
构建时间属性可以在可选的build.settings文件中提供,该文件使用Lua语法。您可以通过示例here设置和检索plist值。
settings =
{
orientation =
{
default = "portrait",
supported =
{
"portrait", "portraitUpsideDown", "landscapeRight", "landscapeLeft"
}
},
iphone =
{
plist =
{
UIInterfaceOrientation = "UIInterfaceOrientationLandscapeRight",
UISupportedInterfaceOrientations =
{
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight"
},
UIApplicationExitsOnSuspend = true,
UIStatusBarHidden = true,
UIPrerenderedIcon = true
}
}
}
settings.iphone.plist["UIInterfaceOrientation~ipad"] = "UIInterfaceOrientationPortrait"
settings.iphone.plist["UISupportedInterfaceOrientations~ipad"] =
{
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown"
}
您是不是简单地使用应用程序版本号创建变量并记得自己更新它?如果可能的话,它可以通过[system.getPreference](http://developer.anscamobile.com/content/system-os)获得。 – 2012-04-12 16:39:20