Following on from the previous blog entry the next step is seeing the code run on real hardware. To do this the device must be Provisioned.
Fortunately I found an article about Free Provisioning on the Xamarin site.
I already had Xcode installed which saved some time. After following through the article I got to the point of creating the required project in Xcode and was seeing the following error.
There are no devices registered in your account on the developer website. Plug in and select a device to have Xcode register it.
After some googling I found the trick was to stay on the screen with the error showing and use the drop-down in the top left to select my device (instead of the default Simulator). After clicking play and allowing the certificate on my device (as prompted) the blank Xcode project runs on my real device.
It’s worth noting, my development target is a 5th Gen iPhone Touch that was given to me as it doesn’t hold charge. It’s 32-bit, and the maximum iOS version it will run is 9.3.5. I changed another setting to allow that in Xcode. To make the architecture 32-bit in Xamarin Studio isn’t quite as obvious, but another article on the Xamarin site Compiling for Different Devices showed me what to set. and has a handy table listing all architecture targets. In the Xamarin Studio project options this relates to Project Options -> iOS Build -> Supported architectures.
Now I need to run my MonoGame project on a device via Xamarin Studio. After a bit of poking around and right-clicking the project (not solution) I find the place to select the Signing Identity, which now shows my Apple ID. When selected the Provisioning Profile doesn’t change as expected. Unsurprisingly it doesn’t work when trying to run the project. The error is /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No installed provisioning profiles match the installed iOS signing identities. I found a post about the error, one reply suggested that the Apple ID needs to be added in Apple Developer Accounts which can be found in Publishing under Preferences. Now, I don’t have a developer account yet (that’s what Free Provisioning is all about) but as it also uses an Apple ID I thought I’d give it a shot. Adding one requires installing something called fastlane, which I’ve never heard of, and isn’t installed. I follow the link, and go through the article. After doing this, and repeating the process with fastlane now installed I’m able to add my Apple ID to the list. This doesn’t fix anything immediately, and restarting Xamarin Studio doesn’t help either. Revisiting the forum post again I find another nugget of information (by poster MikaY). It was something mentioned in an information bubble next to the unpolulated Provisioning Profile which didn’t make sense until now. You have to make the “Bundle Identifier” in the Info.plist, which I find resides in the Xamarin Studio project match the one in the Xcode project.
This gets me past the error I was having straight into another one.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: Failed to codesign ‘bin/iPhone/Debug/device-builds/ipod5.1-9.3.5/CPTest.app/libxamarin-debug.dylib’: libc++abi.dylib: terminating with uncaught exception of type Security::UnixError: UNIX error exception: 13
I Google the error, and find this post which basically says “You’re building from a share”…
So I copy the project to the Mac and build it from there.
Then it throws an exception (Microsoft.Xna.Framework.Audio.NoAudioHardwareException). I try it on my iPad and on my iPhone. All fine. Phew!
So my initial code sharing solution isn’t working, and I had also previously hit a problem with it making Game1.cs and another project file hidden. I have a plan.. Keep the project on the Mac, but link the project to the Game1.cs on the Windows share. Following yesterdays method, I press stop, change the colour, press play, and that works too. I do discover that the hidden file issue still exists, and is caused by every edit of the file.
- I’ve created a Free Provisioning profile in Xcode.
- I’ve been able to use this with all my devices from Xcode.
- I’ve got Xamarin Studio using the Free Provisioning profile, but the iPod Touch is throwing an exception in MonoGame.
So a mostly succesful day, slightly soured by the fact that the one actual permanent device I’ve got for development is the only device of the three that has an issue.