如何在 Windows 上调试 iPad Flash 应用程序?

发布于 2024-12-12 04:30:29 字数 521 浏览 0 评论 0原文

可能的重复:
调试设备上的 iOS/AIR 内容

我正在移植我的 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 应用程序?

Possible Duplicate:
Debugging iOS/AIR content on the device

I'm porting my Air app to iPad. I compiled it with:

adt -package -target ipa-ad-hoc -storetype pkcs12 -keystore store.p12 -storepass ****** -provisioning-profile profile.mobileprovision app.ipa app.xml app.swf

App was deployed on device through iTunes. When I launch app on iPad I get a black screen. Looks like some exception is thrown or something like that. How can I see that exception? Or if to be more general, how do you guys debug iOS app on Windows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

能怎样 2024-12-19 04:30:29

据我所知,无法使用 AIR 和 iOS 进行远程调试。因此,您必须恢复在某处创建滚动文本字段并在那里显示日志/调试文本。

编辑:请参阅调试设备上的 iOS/AIR 内容

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

还可以定义编译器常量将调试日志语句包含在操作脚本中,以便您可以轻松地打开和关闭它们。

我通常还会先在 Windows 上测试该应用程序,然后再创建它的 iPad 版本。

最后提示:请记住,只有主 swf 才能包含动作脚本。

编辑:

这是一个示例,尝试在执行任何其他动作脚本之前添加此代码:

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);
  }
}

As far as my knowledge goes there is no remote debugging with AIR and iOS possible. So you have to revert to creating a scrolling text field somewhere and show log/debug texts there.

Edit: See Debugging iOS/AIR content on the device.

Edit2: Short tutorial video on debugging on iOS via Flash Prof CS5.5: http://www.youtube.com/watch?v=DanNBN89uhs

You can use the uncaughtErrorEvents property (found in your main documents loaderInfo property) to catch any unhandled error and show it also in the text field (see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/LoaderInfo.html#uncaughtErrorEvents)

There is also the possibility to define compiler constants to enclose debug log statements within actionscript so you can easily turn them on and off.

I normally also test first the application on my windows before creating an iPad version of it.

Final tip: remember that only your main swf can contain actionscript.

Edit:

Here is a example, try to add this code before any other actionscript is executed:

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);
  }
}
季末如歌 2024-12-19 04:30:29

您使用的是 Air 2.7 还是 3.0?当我使用用 alchemy 构建的库时,我遇到了这个问题。由于某种原因,使用 alchemy 库导致出现黑屏。远程调试也对我没有帮助,因为它是最重要的。我通过不包含 alchemy 库来修复它(该库用于快速 JSON 解析)

Are you using Air 2.7 or 3.0? I had this issue when I was using a library built with alchemy. For some reason using the alchemy library caused a blank screen. Remote debugging didn't help me either because it was before everything. I fixed it by not including the alchemy library (the library was for fast JSON parsing)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文