About Me

My photo

My goal is to make a difference in the world, and I think the way to do that is through games. My education is in programming and 3D animating, and I have worked in e-Learning and game development. 

Sunday, April 17, 2016

DevLog: Porting to iOS

So far my experience with porting to iOS has been more frustrating than expected. I had heard from other developers that Unity Cloud Build eliminates the need for a Mac during iOS development in Unity, but sadly that is not true.

Here is what I have done and learned so far (and my information may not be complete yet).

Step 1: Apple Developer Account. It costs $100/year and is required to do basically any sort of iOS development.

Step 2: Cert and Keychain...This was the first step where I needed a Mac. Once you have an Apple Developer Account, you will need a Certification. To get that you send a Certificate Signing Request (csr) from a Mac, and receive a file back. You can do either a Development Certificate or a Distribution Certificate (this whole step was very confusing, and I don't actually know how I did it but I must've done it right because things worked). Next you need a Keychain. Again this step made no sense to me, but the Apple Developer Portal gave me a file, I ran it on  Mac and it turned into a different kind of file (3 files in fact), I then selected 2 of those files and exported them to a .p12 file. All of this made no sense to me, but seemed to work.

Step 3: Build the thing. If you have a Mac that can do things, you can probably just make your Unity iOS build and do xCode things to it. I went the route of Unity Cloud Build (I cannot use my Mac for development as it is 8 years old and doesn't run most software, including xCode). Unity Cloud Build will require the .p12 from the previous step as well as a .mobileprovision file which you get during the Certification process. That's why this is step 3 (I totally tried to do this as step 2, but failed miserably).

Step 4: TestFlight. It's possible that if I had made a Development Certificate I could have somehow manually put my builds onto an iPhone, but since I knew I would be distributing this app I just made a Distribution Certificate (it was also not clear in the instructions why I would choose one over the other). If you make a Distribution Certificate you will need to deploy your app via TestFlight. This is where things got tricky. Unity Cloud Build gave me a .ipa file, but .ipa files cannot be simply uploaded through the Apple Developer page, so I needed either xCode or Application Loader to put up my .ipa (there seems to be no way around this). As mentioned, my very old Mac will not run most programs, so when I got to this step I had to go find a friend with a decent Mac to upload my .ipa to TestFlight. Once on TestFlight it seems fairly easy to distribute to internal and external testers, but it seems this upload step will be necessary every time I want to test a new build (unless I go back and make a Development Certificate and figure out how to manually install .ipa files).

The challenge of these steps was compounded by the face that I don't actually own any iOS device.

2 comments:

  1. Hi Megan,

    You can accomplish Step 2 on a Windows machine by using OpenSSL. Firstly download and install the appropriate binary from https://indy.fulgan.com/SSL/

    Then run the following commands to generate your signing request...

    openssl genrsa -out mykey.key 2048

    openssl req -new -key mykey.key -out csr.certSigningRequest -subj "/emailAddress=myemail@address.com, CN=mycompanyname, C=US"

    (Replace US in the last command with your country code)

    Upload the signing request to the apple dev portal to generate a cert file. Download it and then run the following commands to generate your P12 file (replace "ios_distribution.cer" in the following command with the name of the cer file you downloaded from the dev portal:

    openssl x509 -in ios_distribution.cer -inform DER -out ios_dev.pem -outform PEM

    openssl pkcs12 -export -inkey mykey.key -in ios_dev.pem -out myp12file.p12

    As far as Step 4, there are some great test/distribution services available that you can upload the IPA file directly to without using ApplicationLoader. The one that I use is www.hockeyapp.net (but app.testfairy.com is also pretty solid)

    Unfortunately you will still need a Mac for the final AppStore submission though - so it's not entirely a Windows solution.

    ReplyDelete
    Replies
    1. Thank you for your comment! This is great info, thanks so much for sharing :) I will definitely try these steps (I have two more games to port).

      Delete