Instructions for testing the gameboy camera integration on real iOS devices
Closed this issue · 5 comments
I am taking a stab at implementing multiple camera support for feature request #637 but I have not been able to figure out how to test my changes on my iPhone. I am able to compile the .app for iOS but I am unable to load that into Xcode to run on device as I expected and have done for other iOS apps.
@LIJI32 could you please share your method for testing changes on physical devices? I am really stoked to get wide angle and telephoto support working for the gameboy camera for newer iPhones.
My device is jailbroken, which makes things easier for me. For non-jailbroken devices, you can use Sideloadly to re-sign the app and install it on your device. Then, launch the app on your phone. In Xcode, have any iOS project open and your device selected as it's target, and select Debug > Attach from the menu bar to attach the debugger. Apple, unfortunately, likes making it very cumbersome to resign and debug iOS apps if you don't build them with Xcode. Let me know if you're having any further troubles.
I nearly got the application loaded on my device but I am having issues with code signing – Unless I'm mistaken, it seems that since I don't have a paid developer account and thus no way to create a provisioning profile, I am unable to load the app on my phone via Xcode. Xcode can manage provisioning profiles for you but it looks like the project has to built through Xcode, which this one is not.
Any tips would be appreciated, but I understand why you're testing with a jailbroken iPhone – way easier.
In the meantime, I wrote the code I intend to test in Draft PR #642, following the patterns I saw in the project and the Apple documentation. If you get a chance maybe you could help me test this on a real device – I tested similar code in a demo project on my device that I didn't have any code signing issues with, so I'm reasonably confident that it should work with minor tweaking.
A free account is actually enough to create provisioning profiles, the only caveat is that they expire after 7 days (after which you need to create a new profile, Sideloadly should do that for you). I'll have a look at your PR soon.
I noticed that I can create 7 day provisioning profiles, but they don't appear to work for me unless the app is built and signed by Xcode – I'm sure this is user error and I am still tinkering with it to see what I'm doing wrong.
I appreciate you looking at my PR in the meantime!
I managed to get this resolved and am happily testing my changes – thanks!
EDIT: Here's how I got this working, in case a future hapless developer comes across this same issue.
- Create a new Xcode iOS hello world app called SameBoy
- Select a bundle identifier and my personal team in the project settings
- Update all bundle identifier and team references in iOS/Info.plist and iOS/sideload.entitlements
- Build SameBoy for iOS
- Locate the automatically created provisioning profile in ~/Library/MobileDevice/Provisioning Profiles/
- Inspect the profile with
security cms -D -I /path/to/profile
- Copy the keys from this provisioning profile into iOS/sideload.entitlements
- Codesign the built application from the terminal, injecting sideload.entitlements with the --entitlements flag. This will re-sign the app with the necessary entitlements from the provisioning profile that your phone is expecting to get from Xcode
- Open the Devices and Simulators tab and manually add the built application. If everything matches (name, bundle id, etc), it will install on top of the hello world app using that provisioning profile
Obviously this is far from ideal. However, this works if you are as stuck as I was, and doesn't require any third party tools or jailbreaking.