设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 80|回复: 0

[制作教程] iOS App creation tutorial for MZ/MV (xcode 12)

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4609

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23225
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28728

    灌水之王

    发表于 2026-7-8 11:35:34 | 显示全部楼层 |阅读模式
    Hello, thanks to all the great minds we've figured out how to deploy MZ/MV project to iOS devices.
    I especially would like to thank
    - MiltonSSR for kicking off the discussion
    - BreakerZerofor giving me hints on initial steps
    - HoofedEarfor many many many tests with me
    -yymessfor solving the tap issue

    Now for the actual program!

    Prerequisites:
    You will need a RPG Maker MZ/MV project, a Mac, an iOS device, and xcode 12.  The process is tad different for xcode 11. If you absolutely have to use xcode 11, please refer to the original threads.
    Also, be sure to get yourself an Apple Developer signing certificate if you want to test or distribute on actual iOS devices.

    Process:
    Step 1: Export your game


    • Under File menu, select Deployment. Make sure to use Web as the platform
    Step 2: Open xcode 12, and create a new project

    • For template, select iOS from the top, and App from Application section.
    Spoiler: detailed settings

    • Enter your product name (we use newmzproj as an example)
    • Select your Apple Developer ID for Team
    • For Organization Identifier, enter your own domain name (if you have any) in reverse. For example, if I have iloverpgmaker.com, I would enter com.iloverpgmaker

      • This will create unique identifier for you - so make sure you use something unique to YOU.

    • For Interface, select [Storyboard]
    • For Life Cycle, select [UIKit App Delegate]
    • Language, [Swift]
    • You can untick Include Tests
    • Could tick Use Core Data but needs further investigation/understanding**

      • RPG Maker uses localforage to store data when running under iOS
      • I am not sure if the locally stored data will be persistent after an App update

    Step 3: Modify the code and create a WKWebView

    • Once you have your project created, you should see ViewController.swift on left panel. Open the file.
    • There should be around 20 or so lines of codes.  Replace with following codes.
    Spoiler: swift code
                    Swift:        
    // //  ViewController.swift // //  https://forums.rpgmakerweb.com/index.php?threads/ios-app-creation-tutorial-for-mz-mv-xcode-12.128674/  import UIKit // Add WebKit import WebKit  // Add WKNavigationDelegate, WKUIDelegate for navigation and ui delegation class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {      var webView: WKWebView!      // This gets called when loading the WKWebView     override func loadView() {         super.loadView()             webView = WKWebView()             let webViewConfig = WKWebViewConfiguration()         webViewConfig.dataDetectorTypes = []         webViewConfig.allowsInlineMediaPlayback = true         webViewConfig.mediaTypesRequiringUserActionForPlayback = []         webView = WKWebView(frame: view.frame, configuration: webViewConfig)         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     }         // This is to allow JavaScript Alert() for debugging     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)     } }


    Step 4: Import MZ/MV game

    • Right click the ViewControllwer.swift on the left panel
    • Select Add Files to "newmzproj"... from the menu
    • Select your games www folder and hit Add

      • Make sure to tick Copy items if needed
      • Select Create folder references

    • Your www folder should be same level as ViewController.swift file
    Step 5: Allow MZ to start without focus (can skip for MV projects)

    • From left panel, navigate to www > js > rmmz_managers.js
    • Around line 2107, there should be SceneManager.isGameActive function. Modify the code to skip the check on focus.
    Spoiler: scenemanager
                    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;     } };


    Step 6: Tune-ups

    • Add a custom iconsto your app!

      • Click on Assets.xcassets from left panel
      • Select AppIcon
      • Just drag&drop files with right size here!

    • Make it landscape only (force side view on ios)

      • Click on your project name from left panel (the most top one)
      • Check the appropriate settings from Device Orientation

        • If you want to force side, tick Landscape Left and Landscape Right



    That's all! Hope to see many awesome games on AppStore

    Happy coding



    本贴来自国际rpgmaker官方论坛作者:mvstone处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ios-app-creation-tutorial-for-mz-mv-xcode-12.128674/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-16 17:30 , Processed in 0.149753 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表