What happened to iOS export option?

● ARCHIVED · READ-ONLY
Started by MiltonSSR 65 posts Page 1 of 4 View original ↗
  1. Looks like MZ doesn't come with Andrios/iOS export option in deployment menu.
    I tried to export to Web and use Cordova to build into an iOS app but that doesn't really work.

    Still trying to figure out how to make this work for iOS. Any input will be appreciated!

    edit: the old method that used to work with MV:

    edit 2: a more up-to-date iOS exporting workflow in Japanese:
    https://kurotsushirou.com/2019/12/10/rpgツクールmv-スマートフォンアプリ iosアプリ/

    edit 3: still no luck. I have tried the following 2 ways to get around the XHR issue but game stucks at black screen after loading sign with BGM music being played:

    1. Using cordova-ios@6.1.0, and plugin @globules-io/cordova-plugin-ios-xhr

    2. Using cordova-ios@5.1.1, and plugin @cordova-plugin-wkwebview-engine, along with the XHR fix at https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix

    edit 4: looks like this is less of a RMMZ issue but Cordova/iOS one. More context: https://stackoverflow.com/questions...va-ios-with-cordova-plugin-ionic-webview-or-c

    Also, this issue on Apple side prevents testing on iOS simulator: https://bugs.webkit.org/show_bug.cgi?id=191064
  2. It was there because you had strip out the Vorbis files on iOS and Android (which the MV scripts couldn't handle in these cases, or at least not without plugins). The MZ scripts don't have this issue, so therefore it was removed as it is no longer necessary.
  3. BreakerZero said:
    It was there for cases where one had to to strip out the Vorbis files (which the MV scripts couldn't handle on iOS or Android, or at least not without plugins). The MZ scripts don't have this issue, so therefore it was removed as it is no longer necessary.

    Thanks for the info. However the official manual for MZ does not mention they support exporting to Mobile like they used to do in MV. Not sure if it’s due to some other incompatibility issues but my export attempts haven’t been successful.
  4. In MV I have no trouble with a properly-configured Xcode project when using the Website export option, so I don't think it would be any different in that respect.
  5. BreakerZero said:
    In MV I have no trouble with a properly-configured Xcode project when using the Website export option, so I don't think it would be any different in that respect.
    Would you mind trying it with MZ? I doubt it would work with the latest Cordova. Found some discussion on similar issues here: https://github.com/apache/cordova-ios/issues/883
  6. If I'm understanding what I'm seeing under deployment....this supposed upgrade, removed the most important deployment options to be able to release the game on mobile............................................................my question is what now? How does one get an RPG Maker MZ on the app store or for android if those features are now removed? I don't see a point to it now as one is now limited to release the game on computer. Why would they downgrade like that?
  7. You need to deploy it as a web/HTML version and then use an app wrapping tool (different tools exist for iOS and Android)
  8. Dr. Delibird said:
    You need to deploy it as a web/HTML version and then use an app wrapping tool (different tools exist for iOS and Android)
    That's what he tried and it didn't seem to work.
  9. Nebula 480 said:
    If I'm understanding what I'm seeing under deployment....this supposed upgrade, removed the most important deployment options to be able to release the game on mobile............................................................my question is what now? How does one get an RPG Maker MZ on the app store or for android if those features are now removed? I don't see a point to it now as one is now limited to release the game on computer. Why would they downgrade like that?

    The automation of this process and preparation was removed, since such steps were required due to deficiencies in the MV core scripts implementations.

    You can simply package the web export of into an appropriate web app wrapper for the platform you're exporting to. The real change is that you now have to be aware of the changes and setup for the android/iOS app and wrapper implementation and maintain that yourself, or find someone in the community who is willing to maintain templates that you can clone and use.
  10. Oi, I'm trying to figure out a way convert a web app to apk with android studio, but so much has changed with permissions since MVs release. I've gotten to the point where its loaded, but am getting canvas errors. If anything, i'll release a video and a benchmark app
  11. Faytless said:
    Oi, I'm trying to figure out a way convert a web app to apk with android studio, but so much has changed with permissions since MVs release. I've gotten to the point where its loaded, but am getting canvas errors. If anything, i'll release a video and a benchmark app
    You may still have to configure the app package in accordance with your requirements. Canvas errors at this point are usually the result of not having certain flags set to mark it as an HTML5 app so that file access is not blocked. It's related to something known as CORS that enforces the security of a cross-origination resource share (hence the name, of course) so you'll either have to specifically mark your app export with the required permissions (file access from file URLs should be what you're looking for, and there's a specific Xcode flag that you also have to set in your app configuration dictionary if you're targeting iOS/Mac) or you add some code to simulate a web server. These are both outside the scope of the forums (and I'd have to check my Xcode work to let you know which flag to set) but once that's done you should be good to go.

    EDIT: Also, in response to Lori senior (meaning @ロリ先輩) that was the very first thing I mentioned. And it's also how I do all of my exports for Xbox testing even on MV.
  12. Update - I got it to work with Cordova (to some extent). It was an XHR issue which can be fixed by this plugin: https://github.com/globules-io/cordova-plugin-ios-xhr

    However, when I run the app on my iPhone 8 plus it just shows black screen + title BGM playing. I checked some logs and it seems that the code for drawing title was running fine and XHR was working as well. However I just couldn't see anything on the screen. Let me know if any of you experience similar problems.

    Also, couldn't get iOS simulation to work at all. The error message is WebAssembly not found.
  13. After working with another individual having this question I have decided to share my procedures for working on Mac/iPhone builds for MV/MZ. At present I have only done this using Xcode, so download that from the app store if you need it. After that, create a Document-based app project using Swift and put the following in its DocumentBrowserViewController.swift file:

    Swift:
    import UIKit
    import SwiftUI
    import WebKit
    
    // MARK: Viewport Setup
    
    class DocumentBrowserViewController: UIViewController, WKNavigationDelegate {
        let webView = WKWebView()
    
        override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
            coordinator.animate(alongsideTransition: nil, completion: { (context) in
                self.webView.evaluateJavaScript("window.scrollTo(0,0)", completionHandler: nil)
            })
        }
    
        override func viewDidAppear(_ animated: Bool) {
            super.viewDidAppear(animated)
            func bitSet(_ bits: [Int]) -> UInt {
                return bits.reduce(0) { $0 | (1 << $1) }
            }
    
            func property(_ property: String, object: NSObject, set: [Int], clear: [Int]) {
                if let value = object.value(forKey: property) as? UInt {
                    object.setValue((value & ~bitSet(clear)) | bitSet(set), forKey: property)
                }
            }
    
            // disable full-screen button
            if  let NSApplication = NSClassFromString("NSApplication") as? NSObject.Type,
                let sharedApplication = NSApplication.value(forKeyPath: "sharedApplication") as? NSObject,
                let windows = sharedApplication.value(forKeyPath: "windows") as? [NSObject]
            {
                for window in windows {
                    let resizable = 3
                    property("styleMask", object: window, set: [], clear: [resizable])
                    let fullScreenPrimary = 7
                    let fullScreenAuxiliary = 8
                    let fullScreenNone = 9
                    property("collectionBehavior", object: window, set: [fullScreenNone], clear: [fullScreenPrimary, fullScreenAuxiliary])
                }
            }
            #if targetEnvironment(macCatalyst)
                //webView.frame = CGRect(x: 0, y: 28, width: self.view.frame.width, height: self.view.frame.height)
            #endif
            webView.scrollView.isScrollEnabled = false
        }
    
        override func viewDidLoad() {
            super.viewDidLoad()
            webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
            //webView.configuration.preferences.setValue(true, forKey: "allowUniversalAccessFromFileURLs")
            let htmlPath = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www")!
            webView.loadFileURL(htmlPath, allowingReadAccessTo: htmlPath)
            webView.navigationDelegate = self
            view = webView
    
        }
    
    
        func scene(_: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) {
          // ...
        }
    
    
        // MARK: Delegate Setup
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: @escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
            let newDocumentURL: URL? = nil
      
            // Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
            // Make sure the importHandler is always called, even if the user cancels the creation request.
            if newDocumentURL != nil {
                importHandler(newDocumentURL, .move)
            } else {
                importHandler(nil, .none)
            }
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentsAt documentURLs: [URL]) {
            guard let sourceURL = documentURLs.first else { return }
      
            // Present the Document View Controller for the first document that was picked.
            // If you support picking multiple items, make sure you handle them all.
            presentDocument(at: sourceURL)
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didImportDocumentAt sourceURL: URL, toDestinationURL destinationURL: URL) {
            // Present the Document View Controller for the new newly created document
            presentDocument(at: destinationURL)
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
            // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
        }
    
        // MARK: Document Presentation
    
        func presentDocument(at documentURL: URL) {
            let document = Document(fileURL: documentURL)
    
            // Access the document
            document.open(completionHandler: { success in
                if success {
                    // Display the content of the document:
                    let view = DocumentView(document: document, dismiss: {
                        self.closeDocument(document)
                    })
    
                    let documentViewController = UIHostingController(rootView: view)
                    self.present(documentViewController, animated: true, completion: nil)
                } else {
                    // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
                }
            })
        }
    
        func closeDocument(_ document: Document) {
            dismiss(animated: true) {
                document.close(completionHandler: nil)
            }
        }
    }

    After that, go into your primary target's info tab and insert a dictionary definition for App Transport Security Settings. In this dictionary you will add an entry for the Allow Arbitrary Loads configuration, set this to Yes. That will flag the app as having an HTML5 base so that files are loaded and saved properly. After that, just add a reference to the www folder of your MV/MZ output and you should be good to go.

    [This part redacted per moderator response.]
  14. BreakerZero said:
    After working with another individual having this question I have decided to share my procedures for working on Mac/iPhone builds for MV/MZ. At present I have only done this using Xcode, so download that from the app store if you need it. After that, create a Document-based app project using Swift and put the following in its DocumentBrowserViewController.swift file:

    Swift:
    import UIKit
    import SwiftUI
    import WebKit
    
    // MARK: Viewport Setup
    
    class DocumentBrowserViewController: UIViewController, WKNavigationDelegate {
        let webView = WKWebView()
      
        override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
            coordinator.animate(alongsideTransition: nil, completion: { (context) in
                self.webView.evaluateJavaScript("window.scrollTo(0,0)", completionHandler: nil)
            })
        }
      
        override func viewDidAppear(_ animated: Bool) {
            super.viewDidAppear(animated)
            func bitSet(_ bits: [Int]) -> UInt {
                return bits.reduce(0) { $0 | (1 << $1) }
            }
    
            func property(_ property: String, object: NSObject, set: [Int], clear: [Int]) {
                if let value = object.value(forKey: property) as? UInt {
                    object.setValue((value & ~bitSet(clear)) | bitSet(set), forKey: property)
                }
            }
    
            // disable full-screen button
            if  let NSApplication = NSClassFromString("NSApplication") as? NSObject.Type,
                let sharedApplication = NSApplication.value(forKeyPath: "sharedApplication") as? NSObject,
                let windows = sharedApplication.value(forKeyPath: "windows") as? [NSObject]
            {
                for window in windows {
                    let resizable = 3
                    property("styleMask", object: window, set: [], clear: [resizable])
                    let fullScreenPrimary = 7
                    let fullScreenAuxiliary = 8
                    let fullScreenNone = 9
                    property("collectionBehavior", object: window, set: [fullScreenNone], clear: [fullScreenPrimary, fullScreenAuxiliary])
                }
            }
            #if targetEnvironment(macCatalyst)
                //webView.frame = CGRect(x: 0, y: 28, width: self.view.frame.width, height: self.view.frame.height)
            #endif
            webView.scrollView.isScrollEnabled = false
        }
    
        override func viewDidLoad() {
            super.viewDidLoad()
            webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
            //webView.configuration.preferences.setValue(true, forKey: "allowUniversalAccessFromFileURLs")
            let htmlPath = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www")!
            webView.loadFileURL(htmlPath, allowingReadAccessTo: htmlPath)
            webView.navigationDelegate = self
            view = webView
    
        }
      
    
        func scene(_: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) {
          // ...
        }
      
    
        // MARK: Delegate Setup
      
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: @escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
            let newDocumentURL: URL? = nil
          
            // Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
            // Make sure the importHandler is always called, even if the user cancels the creation request.
            if newDocumentURL != nil {
                importHandler(newDocumentURL, .move)
            } else {
                importHandler(nil, .none)
            }
        }
      
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentsAt documentURLs: [URL]) {
            guard let sourceURL = documentURLs.first else { return }
          
            // Present the Document View Controller for the first document that was picked.
            // If you support picking multiple items, make sure you handle them all.
            presentDocument(at: sourceURL)
        }
      
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didImportDocumentAt sourceURL: URL, toDestinationURL destinationURL: URL) {
            // Present the Document View Controller for the new newly created document
            presentDocument(at: destinationURL)
        }
      
        func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
            // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
        }
      
        // MARK: Document Presentation
      
        func presentDocument(at documentURL: URL) {
            let document = Document(fileURL: documentURL)
    
            // Access the document
            document.open(completionHandler: { success in
                if success {
                    // Display the content of the document:
                    let view = DocumentView(document: document, dismiss: {
                        self.closeDocument(document)
                    })
    
                    let documentViewController = UIHostingController(rootView: view)
                    self.present(documentViewController, animated: true, completion: nil)
                } else {
                    // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
                }
            })
        }
    
        func closeDocument(_ document: Document) {
            dismiss(animated: true) {
                document.close(completionHandler: nil)
            }
        }
    }

    After that, go into your primary target's info tab and insert a dictionary definition for App Transport Security Settings. In this dictionary you will add an entry for the Allow Arbitrary Loads configuration, set this to Yes. That will flag the app as having an HTML5 base so that files are loaded and saved properly. After that, just add a reference to the www folder of your MV/MZ output and you should be good to go.

    Thanks for the info! I have 2 questions:
    1. Can you elaborate on how to "add a reference to the www folder of your MV/MZ output"?
    2. Not sure if its related to #1 but when I try to build the project without my MZ output I get: ...../AppDelegate.swift:46:39: Value of type 'DocumentBrowserViewController' has no member 'revealDocument'. Would this go away if I add the reference properly?
  15. What you want to do is to go into File => Add files to [project name], locate your game's www folder, select it and set the entry to Create Folder References. Make sure that it is also set to Copy items if needed.

    As for the revealDocument error, I haven't run into that but in case it helps you can also place a WKWebView on the Main.storyboard.

    [This part redacted per moderator response.]
  16. Hey MiltonSSR I had the same issue, but got it working!
    I am totally new to XCODE (first time opening it) so there maybe some inefficiency here and there, but I will share exact steps for reference.
    Please note I only have MV, but in theory, it should work with MZ.

    Here are the steps I took.

    Step 1
    Create a new Document Based App
    • Language and User Interface to SWIFT
    • Untick Include Unit Tests & UI Tests (probably won't affect but I don't need these)

    Step 2
    Add RPG maker resources
    • in xcode left panel, right-click "DocumentBrowserViewController.swift" and select Add Files to "yourproject"...
    • Select www folder from your RPG maker source
    • Tick Copy items if needed
    • Select Create folder reference
    * after this, www folder should be same level as DocumentBrowserViewController.swift

    Step 3
    Modify DocumentBrowserViewController.swift
    • add import WebKit as new import
    • add WKNavigationDelegate to the class inheritance
    • add let webView = WKWebView() var webView = WKWebView()in class
    • replace viewDidLoad() function

    at the end, DocumentBrowserViewController.swift should be like this (you can copy & paste if you'd like)

    Swift:
    import UIKit
    import SwiftUI
    import WebKit //add this as new import
    
    //add WKNavigationDelegate to inheritance
    class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocumentBrowserViewControllerDelegate,WKNavigationDelegate {
        //declare new object
        //let webView = WKWebView()
        var webView = WKWebView()
    
        //copy this chunk over the existing one from BreakerZero's code
        override func viewDidLoad() {
            super.viewDidLoad()
    
            // fix for slow loading by MiltonSSR
            let webViewCofig = WKWebViewConfiguration()
            webViewCofig.dataDetectorTypes = []
            webView = WKWebView(frame: view.frame, configuration: webViewCofig)
    
            webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
            //webView.configuration.preferences.setValue(true, forKey: "allowUniversalAccessFromFileURLs")
            let htmlPath = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www")!
            webView.loadFileURL(htmlPath, allowingReadAccessTo: htmlPath)
            webView.navigationDelegate = self
            view = webView
    
        }
    
        /* below are untouched */
    
        // MARK: UIDocumentBrowserViewControllerDelegate
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: @escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
            let newDocumentURL: URL? = nil
        
            // Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
            // Make sure the importHandler is always called, even if the user cancels the creation request.
            if newDocumentURL != nil {
                importHandler(newDocumentURL, .move)
            } else {
                importHandler(nil, .none)
            }
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentsAt documentURLs: [URL]) {
            guard let sourceURL = documentURLs.first else { return }
        
            // Present the Document View Controller for the first document that was picked.
            // If you support picking multiple items, make sure you handle them all.
            presentDocument(at: sourceURL)
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didImportDocumentAt sourceURL: URL, toDestinationURL destinationURL: URL) {
            // Present the Document View Controller for the new newly created document
            presentDocument(at: destinationURL)
        }
    
        func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
            // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
        }
    
        // MARK: Document Presentation
    
        func presentDocument(at documentURL: URL) {
            let document = Document(fileURL: documentURL)
    
            // Access the document
            document.open(completionHandler: { success in
                if success {
                    // Display the content of the document:
                    let view = DocumentView(document: document, dismiss: {
                        self.closeDocument(document)
                    })
    
                    let documentViewController = UIHostingController(rootView: view)
                    self.present(documentViewController, animated: true, completion: nil)
                } else {
                    // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
                }
            })
        }
    
        func closeDocument(_ document: Document) {
            dismiss(animated: true) {
                document.close(completionHandler: nil)
            }
        }
    }

    Step 4
    define ios target properties
    • Click the root project from XCode left panel
    • Click Info tab
    • Under Custom iOS Target Properties, right click and add row App Transport Security Settings
    • Select newly added App Transport Security Settings and click small + on right
    • Select and add Allow Arbitrary Loads and change value to YES

    Step 5
    Build!!!!!!!

    Optional

    I found that it can get messy when rotating iphone - here is how to 'fix' the orientation.
    Under General tab of your app, tick/untick Portrait / Landscape part to fix orientation.

    Also, modify index.html's meta tag may also help but haven't tried it yet
  17. mvstone said:
    Hey MiltonSSR I had the same issue, but got it working!
    I am totally new to XCODE (first time opening it) so there maybe some inefficiency here and there, but I will share exact steps for reference.
    Please note I only have MV, but in theory, it should work with MZ.

    Here are the steps I took.

    Step 1
    Create a new Document Based App
    • Language and User Interface to SWIFT
    • Untick Include Unit Tests & UI Tests (probably won't affect but I don't need these)

    Step 2
    Add RPG maker resources
    • in xcode left panel, right-click "DocumentBrowserViewController.swift" and select Add Files to "yourproject"...
    • Select www folder from your RPG maker source
    • Tick Copy items if needed
    • Select Create folder reference
    * after this, www folder should be same level as DocumentBrowserViewController.swift

    Step 3
    Modify DocumentBrowserViewController.swift
    • add import WebKit as new import
    • add WKNavigationDelegate to the class inheritance
    • add let webView = WKWebView() in class
    • replace viewDidLoad() function

    at the end, DocumentBrowserViewController.swift should be like this (you can copy & paste if you'd like)

    Swift:
    import UIKit
    import SwiftUI
    import WebKit //add this as new import
    
    //add WKNavigationDelegate to inheritance
    class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocumentBrowserViewControllerDelegate,WKNavigationDelegate {
        //declare new object
        let webView = WKWebView()
     
        //copy this chunk over the existing one from BreakerZero's code
        override func viewDidLoad() {
            super.viewDidLoad()
            webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
            //webView.configuration.preferences.setValue(true, forKey: "allowUniversalAccessFromFileURLs")
            let htmlPath = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www")!
            webView.loadFileURL(htmlPath, allowingReadAccessTo: htmlPath)
            webView.navigationDelegate = self
            view = webView
    
        }
     
        /* below are untouched */
     
        // MARK: UIDocumentBrowserViewControllerDelegate
     
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: @escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
            let newDocumentURL: URL? = nil
         
            // Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
            // Make sure the importHandler is always called, even if the user cancels the creation request.
            if newDocumentURL != nil {
                importHandler(newDocumentURL, .move)
            } else {
                importHandler(nil, .none)
            }
        }
     
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentsAt documentURLs: [URL]) {
            guard let sourceURL = documentURLs.first else { return }
         
            // Present the Document View Controller for the first document that was picked.
            // If you support picking multiple items, make sure you handle them all.
            presentDocument(at: sourceURL)
        }
     
        func documentBrowser(_ controller: UIDocumentBrowserViewController, didImportDocumentAt sourceURL: URL, toDestinationURL destinationURL: URL) {
            // Present the Document View Controller for the new newly created document
            presentDocument(at: destinationURL)
        }
     
        func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
            // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
        }
     
        // MARK: Document Presentation
     
        func presentDocument(at documentURL: URL) {
            let document = Document(fileURL: documentURL)
    
            // Access the document
            document.open(completionHandler: { success in
                if success {
                    // Display the content of the document:
                    let view = DocumentView(document: document, dismiss: {
                        self.closeDocument(document)
                    })
    
                    let documentViewController = UIHostingController(rootView: view)
                    self.present(documentViewController, animated: true, completion: nil)
                } else {
                    // Make sure to handle the failed import appropriately, e.g., by presenting an error message to the user.
                }
            })
        }
    
        func closeDocument(_ document: Document) {
            dismiss(animated: true) {
                document.close(completionHandler: nil)
            }
        }
    }

    Step 4
    define ios target properties
    • Click the root project from XCode left panel
    • Click Info tab
    • Under Custom iOS Target Properties, right click and add row App Transport Security Settings
    • Select newly added App Transport Security Settings and click small + on right
    • Select and add Allow Arbitrary Loads and change value to YES

    Step 5
    Build!!!!!!!

    Optional

    I found that it can get messy when rotating iphone - here is how to 'fix' the orientation.
    Under General tab of your app, tick/untick Portrait / Landscape part to fix orientation.

    Also, modify index.html's meta tag may also help but haven't tried it yet

    Thanks mvstone! It works!

    However even for default blank MZ projects, my app on iPhone 8+ loads super slow (black screen for ~3 minutes before menu comes up).
    Do you experience slow loading time as well?
    In addition, iOS simulator doesn't really work for me - does it work on your side?
  18. Actually, solved the slow loading problem: just add the following lines to viewDidLoad(), after line "super.viewDidLoad()"

    // fix for slow loading
    let webViewCofig = WKWebViewConfiguration()
    webViewCofig.dataDetectorTypes = []
    webView = WKWebView(frame: view.frame, configuration: webViewCofig)

    source of fix: https://stackoverflow.com/questions...kwebview-to-load-local-html/53527592#53527592

    Another thing is that the app's energy impact is super high (almost red). Not sure if it's possible to solve that
  19. Hey MiltonSSR

    Glad it worked! But credit goes to BreakerZero :guffaw:

    I haven't tried on MZ (will download the trial and test).
    Even on MV, iOS simulator is super super slow - unplayable. It works much faster when done on actual device via test flight.

    I will experiment more and let you know. As for MZ, I read it somewhere the new effect is slow on mobile.

    edit1:
    Thanks for load fix - I updated my previous post to reflect it

    edit2:
    I have installed and tried MZ, but when I try to launch it, RPG Maker returned an error

    ReferenceError
    Can't find variable: WebAssembly
  20. Something is not quite working for MZ.
    I have created a vanilla MZ project to my iPhone 11 Pro (using steps above)

    It builds with no errors, and I can open the app in iPhone, but it stays blank (black screen) forever.

    I then have tried this plugin suggested here to see if it would work, but same blank screen (XCode's debug navigator shows about 5% CPU usage and 33.4MB memory usage)