What happened to iOS export option?

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
I've try using other method and it does not have the blackscreen tap problem.
I guess its not MZ, but your method to export your game to mobile.
you can use crodova too for IOS, but I have no tutorial for it.
Is Cordova still being updated? Last I heard Adobe had abandoned it and now it’s considered taboo to use it.

I wouldn’t mind switching to a different method, but I wanna find out if native Swift can handle it. Which I’m sure it can, I just gotta figure out what flag I’m missing or whatever. I might hire someone to look at it tbh, I’m obsessed with getting this figured out LOL
 

DigitalWF

Regular
Regular
Joined
Apr 13, 2020
Messages
227
Reaction score
66
First Language
English
Primarily Uses
RMMV
Is Cordova still being updated? Last I heard Adobe had abandoned it and now it’s considered taboo to use it.

I wouldn’t mind switching to a different method, but I wanna find out if native Swift can handle it. Which I’m sure it can, I just gotta figure out what flag I’m missing or whatever. I might hire someone to look at it tbh, I’m obsessed with getting this figured out LOL
The one that is abandoned is phonegap, the easiest way to make apk.
as for cordova it runs without any warning or problem when I try to make apk with it.
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
I've tried Cordova / IONIC CAPACITOR before with MV, but I had to change things here and there, and I had no idea what I was "fixing" (and it still gave lots of warnings...)

I would try it again (and maybe write step-by-step) but I prefer to stay away from Cordova/Capacitor as it just adds more reason to break things - and try to do it directly

Advantage of Cordova is to access native APIs but I won't be using those... so simpler to just display HTML5 over WebView (if I can figure out the small parts)
 

DigitalWF

Regular
Regular
Joined
Apr 13, 2020
Messages
227
Reaction score
66
First Language
English
Primarily Uses
RMMV
I've tried Cordova / IONIC CAPACITOR before with MV, but I had to change things here and there, and I had no idea what I was "fixing" (and it still gave lots of warnings...)

I would try it again (and maybe write step-by-step) but I prefer to stay away from Cordova/Capacitor as it just adds more reason to break things - and try to do it directly

Advantage of Cordova is to access native APIs but I won't be using those... so simpler to just display HTML5 over WebView (if I can figure out the small parts)
In MV I just use altimit method and all is good and smooth. Some assets got delay though. as for MZ according to my experiment not a single error warning pops out when everything is set up correctly.
However the effekseer animation performance is not great,with any method for MZ
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
Can you link to altimit method? And are you talking about iOS export, or Android?
 

DigitalWF

Regular
Regular
Joined
Apr 13, 2020
Messages
227
Reaction score
66
First Language
English
Primarily Uses
RMMV
Can you link to altimit method? And are you talking about iOS export, or Android?
oh sorry it looks like it's android only. As for IOS I have no knowledge with how to export mv project since I don't have a mac.
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
Alright... so it could be a bug with WebView around Audio Playback but not sure. As xcode returns this error in the opening.

RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x1053554b0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
}

I made a few updates to my swift code that I can
1. Use alert() in WebView to debug-track all JS files
2. Added didFinish to inject JavaScript better (after the canvas was drawn after other JS were loaded but seems right before canvas was created?)

Here is the new code (just replace the top parts from previous post)

Swift:
import UIKit
import SwiftUI
// Add WebKit
import WebKit

// Add WKNavigationDelegate, WKUIDelegate for navigation and ui delegation
class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocumentBrowserViewControllerDelegate, WKNavigationDelegate, WKUIDelegate {

    var webView: WKWebView!

    // This gets called when loading the WKWebView
    override func loadView() {
        super.loadView()
    
        webView = WKWebView()
    
        let webViewCofig = WKWebViewConfiguration()
        webViewCofig.dataDetectorTypes = []
        webViewCofig.allowsInlineMediaPlayback = true
        webViewCofig.mediaTypesRequiringUserActionForPlayback = []
        webView = WKWebView(frame: view.frame, configuration: webViewCofig)
        webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
    
    }

    // Called after the WebView was created
    override func viewDidLoad() {
        super.viewDidLoad()
    
        let htmlPath = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www")!
        webView.loadFileURL(htmlPath, allowingReadAccessTo: htmlPath)
    
        webView.navigationDelegate = self
        webView.uiDelegate = self
        view = webView
    }

    // Called after HTML was loaed
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
    
        // This will output the content of BODY in XCODE debug (to prove its called after canvas was drawn)
        webView.evaluateJavaScript("document.body.innerHTML") { value, error in
            print(value as? String ?? "")
        }
    
        // Simulating click() to body... but didn't help
        webView.evaluateJavaScript("document.body.click()") {value, error in print(error ?? "")
        }

      //webView.stopLoading()
       // If you uncomment this, MZ will display something like 
       // Failed to load
       // js/libs/effekseer.wasm
    }

    // This is to allow Alert()
    func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
        // alert
        let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert)
        let action = UIAlertAction(title: "OK", style: .default) { _ in
            completionHandler()
        }
        alertController.addAction(action)
        present(alertController, animated: true, completion: nil)
    }

    /* Below this is the default code */

    // MARK: UIDocumentBrowserViewControllerDelegate

There are so much more to learn in XCODE haha
 
Last edited:

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
Alright... so it could be a bug with WebView around Audio Playback but not sure. As xcode returns this error in the opening.
I noticed that error too in my builds! I read somewhere that it has something to do with this:
iPhones have this set to false by default, maybe we need to ensure this is enabled?

EDIT: Here are the two relevant bits of code I will try today once I'm home:
Swift:
let webViewCofig = WKWebViewConfiguration()
//new stuff below
webViewCofig.dataDetectorTypes = []
webViewConfig.allowsInlineMediaPlayback = true
//end of new stuff
webViewConfig.mediaTypesRequiringUserActionForPlayback = []
webView = WKWebView(frame: view.frame, configuration: webViewCofig)
webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
 
Last edited:

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
Yeah I tried it before but didn't seem to help ... but let me try again too.

Updated the code above to reflect changes. Looks like it loaded a bit (the error shows up without tapping) but I still need to tap to finish loading.....
 
Last edited:

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
Yeah I tried it before but didn't seem to help ... but let me try again too.
Check the new edit I made! Try it out and see if that works

EDIT: I wonder if we test the same Swift code we are using with an RPG Maker MV game, that would confirm for us weather this is an MZ problem or an iOS bug.
 
Last edited:

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
EDIT: I wonder if we test the same Swift code we are using with an RPG Maker MV game, that would confirm for us weather this is an MZ problem or an iOS bug.

Thanks for sharing the code - its the same code as I tried but did not solve the problem ;_;
However, it seems to load a tad more than previously (shows the error before tapping the screen).
As for MV, it loads just fine. It is MZ that is causing a problem...

Interestingly, when I added
webView.stopLoading()
to the code block, MZ shows failure loading effekseer.wasm ... which is part of the new effect engine MZ uses.

for codes I use, please refer to my previous post as I try to keep it up-to-date with my changes
 

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
Thanks for sharing the code - its the same code as I tried but did not solve the problem ;_;
However, it seems to load a tad more than previously (shows the error before tapping the screen).
As for MV, it loads just fine. It is MZ that is causing a problem...

Interestingly, when I added
webView.stopLoading()
to the code block, MZ shows failure loading effekseer.wasm ... which is part of the new effect engine MZ uses.

for codes I use, please refer to my previous post as I try to keep it up-to-date with my changes

Here is another resource that could point us in the right direction.
I really hope we can get this figured out, because a Basic RPG Maker MZ game with no plugins barelyyy makes the threshold to be posted on itch.io (you only get about 100 other files) and runs very slowww on the first run (since it needs to cache the files for the animations)
MZ is getting pretty close to the "not worth it" territory for me
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
Thanks HoofedEar
This looks really interesting... There are certainly more layers in my project than the example...

I will try to find some time and try things out for sure.
My MZ demo license is expiring in like 20 days.. Hope we can figure it out before it expires!
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
tl;dr
Took Cordova/Ionic approach, didn't work (plays music, blank screen - same as our method) ;_;

Step-by-step instruction (for MacOS) source
You need to install node.js and npm first. If you get error with below command, google and install these two
Bash:
node --version
npm --version

1) Install ionic and dependencies
Bash:
sudo npm install -g @ionic/cli
sudo npm install cordova-plugin-nativestorage
sudo npm install @ionic-native/native-storage
sudo npm install @capacitor/ios@latest
sudo npm audit fix

2) Create the project
We will create a project directry rmmz and a project called mztest
Bash:
mkdir ~/Documents/rmmz
cd ~/Documents/rmmz
ionic start mztest blank

Ionic setup will ask you a few questions, answer as follows
choose Angular / React >>> Angular
Integrate your new app with Capacitor (y/N) >>> Y
Create free Ionic account (y/N) >>> N

3) Enable capacitor and initialize
Bash:
ionic integrations enable capacitor
npx cap init mztest com.rmmz.mztest

For com.rmmz.mztest part, use your domain in reverse with project name

4) Copy RPG Maker files to www folder
Under ~/Document/rmmz/ add your www folder, so there is ~/Document/rmmz/www with MZ contents

5) Add iOS and sync contents
Bash:
npx cap add ios
npx cap sync ios

Every time you make a change to www folder contents (whenever you update your rpg maker project) make sure to run npx cap sync ios

6) Open your project

Bash:
npx cap open ios

When you compile, it'll give you lots of warnings, but just ignore those....
 

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
tl;dr
Took Cordova/Ionic approach, didn't work (plays music, blank screen - same as our method) ;_;
Thanks a lot for looking into this and putting it together!
This essentially proves that RMMZ has a bug, so we should probably make a post about it in the Bug section to let them know about it
 

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
According to this Japanese forum thread, MV apps will have difficulties running under upcoming iOS 14 :kaomad2:

So I really wish to have this working with MZ (then I'll buy MZ :troll:
 

yymess

Warper
Member
Joined
Oct 13, 2020
Messages
2
Reaction score
4
First Language
Chinese
Primarily Uses
RMMZ
Thanks for all the information provided by you guys. My friends and I are excited to tell you that we have found the solution of Black Screen problem.

open the file: rmmz_managers.js
And find out below code:
JavaScript:
SceneManager.isGameActive = function() {
    // [Note] We use "window.top" to support an iframe.
    try {
        return window.top.document.hasFocus();
    } catch (e) {
        // SecurityError
        return true;
    }
};
then turn into:
JavaScript:
SceneManager.isGameActive = function() {
    return true;
    // [Note] We use "window.top" to support an iframe.
    try {
        return window.top.document.hasFocus();
    } catch (e) {
        // SecurityError
        return true;
    }
};
We found that the cause of the problem is MZ Added a function to determine whether the application is in the background.And the ".document.hasFocus()"will judge whether there is interaction, which will affect the scene whether update or not.So we simply skip this judgment to solve this problem.
Hope this can help you guys.
 

HoofedEar

Regular
Regular
Joined
Aug 27, 2020
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RM2k3
then turn into:
JavaScript:
SceneManager.isGameActive = function() {
    return true;
    // [Note] We use "window.top" to support an iframe.
    try {
        return window.top.document.hasFocus();
    } catch (e) {
        // SecurityError
        return true;
    }
};
We found that the cause of the problem is MZ Added a function to determine whether the application is in the background.And the ".document.hasFocus()"will judge whether there is interaction, which will affect the scene whether update or not.So we simply skip this judgment to solve this problem.
Hope this can help you guys.
Wow, great work finding this! I will do some testing today to verify on my own builds, but this looks like this could be the ticket!
Since we are already overriding the function, we should be able to reduce it to this:

JavaScript:
SceneManager.isGameActive = function() {
    return true;
};
I'll edit my post here with findings once I get the chance to test it out!

EDIT: I made the stupid decision of updating my Xcode to version 12 which COMPLETELY changes how Document Apps are made. So I'm just giving up on this.
Godspeed everyone.
 
Last edited:

mvstone

Villager
Member
Joined
Sep 3, 2020
Messages
19
Reaction score
12
First Language
JP, EN
Primarily Uses
RMMV
yymess thank you so much! Got it working.

HoofedEar no worries, I got you covered! (I got it running on XCODE 12.0.1) will write up the step-by-step instruction later
 

Latest Threads

Latest Posts

Latest Profile Posts

So the concept for my Game Jam project is way more than I can complete before the deadline. But I think I found a way to get the core done and make the incomplete parts either not really noticeable or make them a part of the story for now. That sneaky, dastardly Krampus! Then I can complete the rest. Did I mention that this is fun?
I've been working on a game called "Eternal Sunset". Is there anywhere here i can "show it off" maybe? Wondering what others think.
What do you do when there are lots of offers online but you don't have even a slight chance of ever playing those myriads of games?
Ugh, mispelled my username.

Forum statistics

Threads
136,545
Messages
1,267,351
Members
180,217
Latest member
GabooCat
Top