【问题标题】:Phaser 3 in Cordova App: How to use images properly in a iOS versionCordova App 中的 Phaser 3:如何在 iOS 版本中正确使用图像
【发布时间】:2021-06-22 04:45:40
【问题描述】:

我在 Cordova 应用程序中使用 Phaser 3。 我正在尝试在屏幕上显示图像。 该代码在浏览器版本中正常工作。 因此,如果我运行:cordova run browser 然后一切正常显示。

但是如果我运行cordova run ios

然后图像无法正确显示。 我也使用 Xcode 打开了该应用程序,但没有看到任何相关错误。

以下是相关部分:

function preload ()
{
    console.log('preload.......')
    this.load.image("emptytile", "./assets/sprites/emptytile.png");
    // this.load.image("logo", "url(../img/logo.png)");
    this.load.image("logo", "./assets/sprites/logo.png");
}

function create ()
{


    this.add.image(200, 200, "emptytile");   
    this.add.image(30, 100, "logo"); 
    
    const ThirtyConsonantsButton = this.add.text(100, 100, 'Thirty Consonants', { fill: '#0f0' })
    ThirtyConsonantsButton.setInteractive();

    ThirtyConsonantsButton.on('pointerdown', () => { console.log('pointerdown'); });

  
}

然后为了查看任何可能的错误,我通过 Xcode 打开应用程序,控制台调试区域显示以下内容:

2021-03-25 19:25:01.049522+0800 HelloCordova[23044:1549947] Apache Cordova native platform version 6.2.0 is starting.
2021-03-25 19:25:01.049690+0800 HelloCordova[23044:1549947] Multi-tasking -> Device: YES, App: YES
2021-03-25 19:25:01.058846+0800 HelloCordova[23044:1549947] Could not load the "LaunchStoryboard" image referenced from a nib in the bundle with identifier "io.cordova.hellocordova"
2021-03-25 19:25:01.291165+0800 HelloCordova[23044:1549947] The preference key "AllowNewWindows" is not defined and will default to "FALSE"
2021-03-25 19:25:01.292422+0800 HelloCordova[23044:1549947] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE"
2021-03-25 19:25:01.297305+0800 HelloCordova[23044:1549947] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE"
2021-03-25 19:25:01.297452+0800 HelloCordova[23044:1549947] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE"
2021-03-25 19:25:01.297533+0800 HelloCordova[23044:1549947] CDVWebViewEngine will reload WKWebView if required on resume
2021-03-25 19:25:01.297660+0800 HelloCordova[23044:1549947] Using WKWebView
2021-03-25 19:25:01.298095+0800 HelloCordova[23044:1549947] [CDVTimer][console] 0.048995ms
2021-03-25 19:25:01.298296+0800 HelloCordova[23044:1549947] [CDVTimer][handleopenurl] 0.058055ms
2021-03-25 19:25:01.299815+0800 HelloCordova[23044:1549947] [CDVTimer][intentandnavigationfilter] 1.384974ms
2021-03-25 19:25:01.300050+0800 HelloCordova[23044:1549947] [CDVTimer][gesturehandler] 0.066042ms
2021-03-25 19:25:01.300178+0800 HelloCordova[23044:1549947] [CDVTimer][TotalPluginStartup] 2.219081ms
2021-03-25 19:25:01.442929+0800 HelloCordova[23044:1549947] WF: === Starting WebFilter logging for process HelloCordova
2021-03-25 19:25:01.443112+0800 HelloCordova[23044:1549947] WF: _userSettingsForUser : (null)
2021-03-25 19:25:01.443229+0800 HelloCordova[23044:1549947] WF: _WebFilterIsActive returning: NO
2021-03-25 19:25:02.073818+0800 HelloCordova[23044:1549947] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"
2021-03-25 19:25:02.884798+0800 HelloCordova[23044:1549947] Running cordova-ios@6.2.0
2021-03-25 19:25:02.885008+0800 HelloCordova[23044:1549947]      Phaser v3.53.1 (WebGL | Web Audio)  https://phaser.io
2021-03-25 19:25:02.885198+0800 HelloCordova[23044:1549947] resizeGame
2021-03-25 19:25:02.970339+0800 HelloCordova[23044:1549947] preload.......

【问题讨论】:

    标签: ios xcode cordova phonegap phaser-framework


    【解决方案1】:

    这篇文章有答案:

    Cordova iOS Cross origin requests are only supported for HTTP

    cordova plugin add https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix
    

    希望这对未来的其他人有所帮助....

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-21
      • 1970-01-01
      • 1970-01-01
      • 2020-08-03
      • 2021-03-05
      • 2016-02-24
      • 2018-12-15
      • 1970-01-01
      相关资源
      最近更新 更多