Playn 在iOS上运行简单代码时出现异常

Playn 在iOS上运行简单代码时出现异常,playn,Playn,在iOS上运行一段在Java上运行良好的代码时,出现以下异常: Unhandled Exception: java.lang.IllegalStateException: Attempted to generate texture before GL was initialized. You cannot create and render SurfaceLayer in Game.init() on iOS. 2014-02-13 02:12:18.821 ProjectMainJava[1

在iOS上运行一段在Java上运行良好的代码时,出现以下异常:

Unhandled Exception:
java.lang.IllegalStateException: Attempted to generate texture before GL was initialized. 
You cannot create and render SurfaceLayer in Game.init() on iOS.
2014-02-13 02:12:18.821 ProjectMainJava[19077:21e03] Unhandled managed exception: Attempted to generate texture before GL was initialized. You cannot create and render SurfaceLayer in Game.init() on iOS. (java.lang.IllegalStateException)
  at playn.ios.IOSGLContext.createTexture (Boolean repeatX, Boolean repeatY, Boolean mipmaps) [0x001e7] in IOSGLContext.java:165 
  at playn.ios.IOSGLContext.createTexture (Int32 width, Int32 height, Boolean repeatX, Boolean repeatY, Boolean mm) [0x0000a] in IOSGLContext.java:170 
  at playn.core.gl.SurfaceGL.createTexture () [0x00001] in SurfaceGL.java:63 
  at playn.core.gl.SurfaceGL..ctor (playn.core.gl.GLContext ctx, Single width, Single height) [0x00045] in SurfaceGL.java:34 
  at playn.core.gl.GraphicsGL.createSurfaceGL (Single width, Single height) [0x00001] in GraphicsGL.java:88 
  at playn.core.gl.GraphicsGL.createSurface (Single width, Single height) [0x00001] in GraphicsGL.java:84 
  at ma.company.core.ProjectMainJava.init () [0x0006d] in ProjectMainJava.java:41 
  at playn.ios.IOSPlatform.run (Game game) [0x00009] in IOSPlatform.java:353 
  at playn.core.PlayN.run (Game game) [0x00001] in PlayN.java:47 
  at ma.company.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
  at ma.company.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0 
我可以看到“之前”日志,但不能看到“之后”


PlayN 1.7版。

问题已在此处解决:

解决办法是:

final Image bi = PlayN.assets().getImage("images/BG.png");
AssetWatcher assetWatcher = new AssetWatcher(
    new AssetWatcher.Listener() {

        @Override
        public void done() {
            //Create all the layers here..
        }

        @Override
        public void error(Throwable e) {
            PlayN.log().debug("Interface game menu load error");
        });

    assetWatcher.add(bi);
    assetWatcher.start();