macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Guide on building for iOS

Open dotellie opened this issue 3 years ago • 6 comments

iOS support is mentioned in a lot of places for macroquad, but I can't seem to find a definitive guide on how to actually build an iOS app from the Rust source. The closest I could get was the miniquad sample project which I'm not sure how to translate to macroquad, especially with the macros. Some documentation (or just a little help so that I could write a guide) would be awesome!

dotellie avatar Oct 09 '21 10:10 dotellie

Unfortunately this sample project is the only piece of documentation we have :( Good news - macroquad have exactly the same build pipeline as a miniquad, so the example would just map 1 to 1. Bad news - I do not have any apple devices myself and therefore *quads are quite untested on ios, so expect some problems :(

not-fl3 avatar Oct 09 '21 16:10 not-fl3

Just wondering... still no apple device? :)

EvoTeamDevelop avatar Aug 17 '22 20:08 EvoTeamDevelop

@dotellie I don't know if you ever solved this or if you're still interested 😄 But anyway, did you find this guide? https://macroquad.rs/articles/ios/

It's a bit outdated now, but the Simulator part is still valid. For the device I managed to get my game to run on my iPhone after a lot of painfulness. Eventually it wasn't to different from that guide though. The differences was mainly:

  1. There's no --scent option to codesign and there's no role for a .scent file to play.
  2. We don't need to sign the executable, only the .app folder.
  3. I needed to provide an Entitlements file to codesign (ios-deploy gave zero clues about this, so it took me forever to figure it out, but eventually I realized I could use the Console.app to see what was logged when the installation failed.) I don't know how general this is because it seems a bit arbitrary what XCode does when creating the provisioning file that we copy. But also the contents of the entitlements file seem to be similar to what that .scent file had, so maybe it is general.

I created my game using this tuturial https://macroquad-introduktion.agical.se/ (which I think you can read, right?), btw.

The Entitlements file needs only have this (so far, I guess it depends on what the game needs). MittSpel.entitlements.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>application-identifier</key>
  <string><MY-TEAM-IDENTIFIER>.com.mittspel</string>
</dict>
</plist>

And I can sign my app using this:

codesign --force --timestamp=none --sign LONGHEXID --generate-entitlement-der --entitlements MittSpel.entitlements.xml MittSpel.app

Actually it works without --generate-entitlement-der, but maybe that gets needed later, since I don't know what I'm doing I am keeping it.

@not-fl3, I can update that ios guide, if you like.

PEZ avatar Jan 03 '24 23:01 PEZ

Sure, feel free to send a PR for the original articel!

However, I uploaded a binary to iPhone with the commands from the original article just a few days ago, so it might be a difference between Mac versions or something. Either way, having more info in the articles for more Mac versions would be always helpful!

not-fl3 avatar Jan 04 '24 03:01 not-fl3

Interesting. What versions of macOS and XCode are you using? I'll include my versions in my update.

I tried to web search for --scent and .scent files, btw, and pulled up nothing. The only thing that showed up was that Macroquad iOS article. 😄

PEZ avatar Jan 04 '24 09:01 PEZ

PR sent:

  • https://github.com/not-fl3/macroquad-website/pull/10

PEZ avatar Jan 04 '24 13:01 PEZ