Monthly Archives: October 2013
Playing with Evil: Using PhoneGap Build for iOS in Linux
As I am not “fortunate” to have an AppleOS machine to compile a custom plugin for a PhoneGap app. Rather than wait indefinitely for one to be ordered I managed to work around the XCode dependency but still faced the prospect of getting said modified app onto an actual device. Here lies the log of the removal of my immortal soul to be sacrificed to our blessed overlords of Apple. Hail.
Step 1 – Pay for your sins
There is no getting out of forking cash to Apple – even if you plan on just developing test apps for yourself. This. Is. Sad.
So pay for your sins literally. Go through the iOS registration process. Have a cry or strap yourself down to prevent inadvertently killing all living beings (not good for future job prospects) within a 10 mile radius when the registration process goes wrong/takes too long/doesn’t tell you you put your phone number in a format Apple doesn’t like since you’re not in the US*.. dumbass.
Anyway; crisis averted (if you heed my advice about a nice straightjacket). Mourn the loss of your eternal soul.
* BTW: for UK numbers this means that the region code is ’44’ and if you don’t have an extension like I don’t then I put ‘-‘
Step 2 – Get stalked
You will need to register at least one device, which will require knowing the UIID. Plug in your iPhone and run*:
lsusb -s :`lsusb | grep iPhone | cut -d ' ' -f 4 | sed 's/://'` -v | grep iSerial | awk '{print $3}'
*From dakira
Step 3 – Register pointlessly even if it’s just for development
Follow roughly in the steps of this beginner’s guide and ignore 1) the mention of Dreamweaver and 2) the expectation you have a Mac..
Step 3.1 – p12 certificates
You need to download your developers key, which you get from your developer account console. You then generate a file called ios_development.cer
Now:
// replace {Your-Apple-Stalk-ID} with the account name you are associating the stalkyness with openssl req -subj "/CN={Your-Apple-Stalk-ID}/O=User" -nodes -newkey rsa:2048 -keyout private.key -out request.csr // download your ios dev cert, then: openssl x509 -inform der -in ios_development.cer -out certificate.pem openssl pkcs12 -export -in certificate.pem -inkey private.key -name "iOS Developement Certificate" -out certificate_with_key.p12 // you should be prompted to input password
You thus have certificate_with_key.p12 generated. Remember your password – stick it in a file with the rest of that crap.
Step 3.2 – Provisioning profiles
You now have 1) a registered device 2) a p12 certificate to register the provisioning profile. Follow the prompts to register an App ID. Associate all 3, then rejoice. Briefly. Minor victory is yours
Step 4 – PhoneGaaaap
Ensure you have your app ready to go. Notice that the iOS build is broken due to the missing profile and certificate. Use the prompts and then recall that password you saved – things aren’t unlocked for use. Once the lock symbol isn’t revelling in your insufficiencies to handle such overly complicated processes rebuild your app in the evil overlord format.
Things should have worked. If not, follow these steps then ‘Build’.
You are still dealing with the evils. Ignore urge to motion your head swiftly and violently onto your desk/nearby wall/friendly police officer.
Step 5 …
:/ Observe the QR code. Attempt to scan said QR code with iPhone as if it were an Android device with the ‘Camera’ application. Pick up jaw from floor realizing that there is no built-in scanning application. Attempt to download QR scanning app. Discover this needs the Apple-Stalk-ID for installing on your test-department device (hell as if you’d have one otherwise). Weep. Go to the URL of the ‘install binary’ for iPhone and get a generic 404 message. Scratch head and stop yourself from introducing the test iPhone to the floor with extreme prejudice..
Go to the PhoneGap build login page on the evil-device iPhone. Log in with your PhoneGap Build details. Go to ‘Apps’. Click download.
Watch as the app gets installed automatically.
Also, if you don’t have a paid PhoneGap Build account you will need to delete your old app and redo the key sign-in before rebuilding. Normally one would say “happy coding” but “faffing” is more accurate. :C
** Image credits to MS Paint Adventures