<分区>
标签 ios actionscript-3 ipad air
<分区>
Possible Duplicate:
Debugging iOS/AIR content on the device
我正在将我的 Air 应用程序移植到 iPad。我编译它:
adt -package -target ipa-ad-hoc -storetype pkcs12 -keystore store.p12 -storepass ****** -provisioning-profile profile.mobileprovision app.ipa app.xml app.swf
应用程序通过 iTunes 部署在设备上。当我在 iPad 上启动应用程序时,出现黑屏。看起来好像抛出了一些异常或类似的东西。我如何才能看到该异常?或者更笼统地说,你们如何在 Windows 上调试 iOS 应用程序?
最佳答案
据我所知,无法使用 AIR 和 iOS 进行远程调试。因此,您必须恢复在某处创建滚动文本字段并在那里显示日志/调试文本。
编辑:参见Debugging iOS/AIR content on the device .
Edit2:通过 Flash Prof CS5.5 在 iOS 上进行调试的简短教程视频:http://www.youtube.com/watch?v=DanNBN89uhs
您可以使用 uncaughtErrorEvents 属性(在主文档 loaderInfo 属性中找到)来捕获任何未处理的错误并将其显示在文本字段中(请参阅 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/LoaderInfo.html#uncaughtErrorEvents )
还可以定义编译器常量以将调试日志语句包含在 ActionScript 中,以便您可以轻松地打开和关闭它们。
我通常还会先在 Windows 上测试该应用程序,然后再创建它的 iPad 版本。
最后提示:请记住,只有您的主 swf 才能包含 ActionScript 。
编辑:
这是一个示例,尝试在执行任何其他 ActionScript 之前添加此代码:
import flash.events.UncaughtErrorEvent;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldType;
// ...
// textLog contains errors
var textLog: TextField;
// make sure there is a uncaughtErrorEvents property (in case of older player)
if (this.loaderInfo.hasOwnProperty('uncaughtErrorEvents'))
{
// listen for uncaught error events
this.loaderInfo['uncaughtErrorEvents'].addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtError);
// make sure text field stays on top
this.addEventListener(Event.ENTER_FRAME, handleEnterFrame);
// create TextField at bottom using 1/5th of stage height
textLog = new TextField();
textLog.width = this.stage.stageWidth;
textLog.height = Math.floor(0.20 * this.stage.stageHeight);
textLog.y = this.stage.stageHeight - textLog.height;
textLog.multiline = true;
textLog.wordWrap = true;
textLog.defaultTextFormat = new TextFormat('_sans', 10);
textLog.type = TextFieldType.DYNAMIC;
textLog.background = true;
textLog.backgroundColor = 0xCCCCCC;
this.addChild(textLog);
textLog.appendText('Catching errors\n');
}
// show error and scroll to bottom line
function handleUncaughtError(anEvent: UncaughtErrorEvent): void
{
textLog.appendText(anEvent.error + '\n');
textLog.scrollV = textLog.maxScrollV;
}
// make sure textLog stays on top of all other children
function handleEnterFrame(anEvent: Event): void
{
if (this.getChildIndex(this.textLog) != this.numChildren - 1)
{
this.addChild(this.textLog);
}
}
关于ios - 如何在 Windows 上调试 iPad Flash 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7903652/
相关文章:
android - 使用 AS3 在 iPhone 和 android 中设置提醒
java - Vsphere Web 客户端 sdk 无法加载属性文件
javascript - 使用 javascript 与 actionscript 3.0 交互
ios - 选择行时 TableViewController 中的两个动画
ios - 什么触发仪器中的 "Color Copied Images"和 "Color Hits Green and Misses Red"?
javascript - 在 iOS 上配置 javascript