Hi all!
I’ve spent the better part of the last couple weeks getting my Windows iOS project to remote build on my Macbook, since building code projects for iOS directly on a Windows machine isn’t supported yet.
I put together a guide for my own future reference, and thought I would share it here to hopefully save someone the headaches I went through getting this under control;
-- [INTRO] --
UE4 Remote Build Guide
Version 1.0
Updated Aug 01-2015
by bzxo + friends
This guide will help you build an iOS Code project residing on a Windows machine, using a remote Mac.
--- [MAC] ---
1) Download and install Xcode
2) Download the UE4 source code to your Mac
2a) Open a terminal window on your Mac, and cd to the root directory. (cd /)
2b) Create a new directory called UE4 at the root directory. (sudo mkdir UE4)
2c) Make sure the permissions are set for the new directory. (sudo chmod 777 UE4) (important)
2d) Get the 4.8 Release Source Code from Github and put it in the UE4 directory you just created. (git clone --url of your fork here--)
Alternatively, download ZIP from Github, unpack in ./UE4, and run setup.sh
3) Export cert and provisioning profiles from Xcode
3a) Add your Apple Dev Account in Xcode (Preferences->Accounts)
3c) Xcode > Apple IDs > Details > Provisioning Profiles > "Show in Finder" > Copy .mobileprovision files to folder on PC (or USB stick)
3d) Xcode > Apple IDs > Details > Signing Identities > "Export" > Input password and export .p12 files to folder on PC (or USB stick)
3e) Open Keychain Access, choose the "My Certificates" category, and move your certificates from "login" to "System"
4) Setup RSync daemon
4a) Make sure you are an administrator on your Mac. You may need to use sudo to create some of the files below.
4b) Open up Terminal and cd to /Library/LaunchDaemons
Here we’ll create a service definition which will allow the daemon to start (through launchd).
4c) Download [https://taoofmac.com/media/cli/rsync/rsync.plist.txt] and copy it into the directory. This file should have the .plist extension.
(Pastebin mirror if download is broken; [http://pastebin.com/k0tdzguE])
(e.g. cp ~/Downloads/rsync.plist)
4d) Check the directory and make sure the owner of the file is root, the group is wheel, and the permissions are rw-r--r--.
Note: If the permissions are not correct, the daemon will not load. You can check if launchd is loading the module correctly by running: sudo launchctl load /Library/LaunchDaemons/rsync.plist
4e) cd to /etc
4f) Create a new file called rsyncd.conf
Here, we create a definition for the “share” the rsync daemon will host.
[root]
path = /
hosts allow = [YOUR PC NAME]
uid = root
gid = wheel
read only = false
comment = Root volume
Essentially, this creates a share called root which points to the root path of the volume ( / ), is readeadable/writeable, only allows connections from the host at [PC NAME], and uses root permissions.
4g) Check the directory and make sure the owner of the file is root, the group is wheel, and the permissions are rw-r-----.
4h) Now we have everything we need run. I didn't need to restart or do anything else - it just worked. If for some reason you can't rsync right away, you may need to restart your machine.
If you port scan (or nmap) your machine, you’ll probably see that the default rsync port is closed (port 873). This is fine, since Launchd will open the port when required.
--- [PC] ---
1) Download the UE4 source code to your PC
1a) Create a directory at the root of your drive called UE4 just as you did on the Mac.
1b) Clone the same fork 4.8 release here.
1c) Run the GenerateProjectFiles.bat
1d) Open the UE4 solution and build it; Studio is set to Development Editor - not Development.
2) Download and install DeltaCopy
2a) Start the DeltaCopy CLIENT and add new Profile;
Username = [Mac Username], Hostname = [Mac Name], and test the connection.
DeltaCopy will succeed in connecting if the Rsync daemon is running on your Mac - you can see first if you're able to connect to \\Mac Computer] through Explorer, to make sure you're on the same network.
3) Open the UE4Editor.exe found in C:\UE4\Engine\Binaries\Win64.
3a) Create a new code base project, be sure to uncheck the 'Include Starter Content', and put the project in the C:/UE4 Folder
4) Setup your project iOS settings
4a) Go to Edit -> Project Settings -> iOS -> and be sure the project is configured for IOS.
4b) Import the Mobile Provision that we exported earlier. This will be automatically copied to a location in your Documents folder.
4c) Import the Certificate (.p12 that we earlier exported from Xcode), input password. This will register the certificate globally on your PC.
Since the editor copies and registers these files, you can now unplug your USB stick or remove the files you exported earlier.
NOTE:
If importing through the editor doesn't work, open C:\UE4\Engine\Binaries\DotNET\IOS\IPhonePackager.exe, click the Already Registered tab, select your test project, and import your certificate through there.
IPP might crash, hang, or throw an error message about a missing .plist file, but it should still work. Shut down IPP when done and refresh your iOS settings in the editor.
4d) Set bundle identifier to com.companyname.yourgame (make sure this matches the string in your mobile provision)
5) In the same tab, find the Remote Build Options (tiny hidden arrow)
5a) Enter the Remote Server Name (Computer name of the Mac)
5b) Enter the Remote User Name (User name of the Mac)
5c) Press the [Generate SSH Key] button
5d) Enter Yes into the terminal
5e) Enter the password of the Mac computer
5f) Press Enter twice to enter an empty passphrase
5g) Enter the password of the Mac computer again
6) Finally, Package Project -> iOS
6a) If successful, files should copy over to /Users/[User name]/UE4/Builds/[PC Name] on your Mac.
If your Windows computer says that it's uploading but nothing is appearing in this folder on your Mac, packaging will fail.
If you end up with error messages, make sure to check that you can access your Mac's file system from your Windows computer, repair disk permissions on your Mac, and check that the above folder has sufficient permissions.
6b) If everything goes right, you will have an IPA in the Binaries/iOS folder of your Windows project folder. It can take a while to build, as it has to upload everything to your Mac and build it.
Install the IPA and test it, or you can use the Launch On iOS Device button, which will make the app appear on your device automatically.
--- [END] ---
-- [NOTES] --
* Imported certificate shows up as invalid in the editor
If you just created a certificate and provision and the editor can't validate it, you might have run into a bug where the editor checks local time for certificate validity, and then UTC time to confirm start and end dates.
This means that if you are in a different time zone, you might have to wait up to 24 hours for the certificate to auto-activate in the Project Settings->iOS tab. Just check again later.
* Clearing out old certificates
To delete old certificates on a Windows computer, run certmgr.msc, go to Personal->Certificates, and delete the appropriate developer and/or distribution certs.
* Clearing out old mobileprovisions
To delete old mobileprovisions, go to [C:\Users\[UserName]\AppData\Local\Apple Computer\MobileDevice\Provisioning Profiles] and delete whichever files aren't needed.
-- [CREDITS] --
Written, tested, compiled by bzxo
SOURCES;
Awdogsgo2heaven's thread for pre-Rsync building; https://forums.unrealengine.com/archive/index.php/t-9122.html
TaoofMac, Setting up Rsync; https://taoofmac.com/media/cli/rsync/howto.html
wittlief, Generating SSH Key; https://answers.unrealengine.com/questions/236362/bug-report-platform-ios-remote-build-options-gener.html
psauer, notes on time; https://answers.unrealengine.com/questions/231483/ios-unable-to-find-valid-certificate-when-importin.html
markusvdr, deleting old certs; https://answers.unrealengine.com/questions/246745/48-importing-certificate-please-wait-mac-and-windo.html
Josh Adams, deleting old mobileprovisions; https://answers.unrealengine.com/questions/223227/remove-obsolete-mobileprovision-profiles-ios.html
psauer, moving keys to System keychain; https://answers.unrealengine.com/questions/261665/rsync-remote-certificates-not-found.html