Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot debug on iOS Simulator #30

Closed
PrimaryFeather opened this issue Jun 24, 2021 · 9 comments
Closed

Cannot debug on iOS Simulator #30

PrimaryFeather opened this issue Jun 24, 2021 · 9 comments

Comments

@PrimaryFeather
Copy link

Hey Josh,

I just tried to get a project to launch in the iOS simulator, but I just can't get it to work. Perhaps you've got an idea what I'm doing wrong?

Packaging seems to be working fine. I added the following configuration to asconfig.json:

"ios_simulator": {
    "output": "bin/Main-Simulator.ipa",
    "platformsdk": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk",
    "signingOptions": {
        "storetype": "pkcs12",
        "keystore": "path/to/dev_certificate.p12",
        "provisioning-profile": "path/to/ios_dev_profile.mobileprovision"
    }
}

When I build this, I get an IPA that I can install manually on the simulator like this:

adt -installApp -platform ios -platformsdk /Applications/Xcode.app/[...]/iPhoneSimulator14.5.sdk -device ios-simulator -simulator "iPhone 8" -package Main-Simulator.ipa

Since this is working, I guess that I set up packaging correctly.
Then I set up a launch configuration like this:

{
    "type": "swf",
    "request": "attach",
    "name": "Launch on iOS Simulator",
    "platform": "ios",
    "connect": true,
    "preLaunchTask": "Adobe AIR: package iOS simulator debug - asconfig.json"
}

(BTW, it would be great to have the simulator option here that Harman recently introduced.)

When I launch this, I receive the empty VSCode error box that allows me to open 'launch.json', and the debug console says:

Device uninstall failed for platform "ios" and application ID "com.gamua.vscode" with status code 15.

I tried it on a different Mac, as well, and there I got status code 14 instead. Not much better. 😉

Do you have any idea what I could check? I'm using the latest stable AIR SDK (33.1.1.476), and have VSCode, macOS (11.4 on Intel) and Xcode in their latest versions.

Thanks a lot in advance, my friend!

@joshtynjala
Copy link
Member

Hi Daniel, it's been a long time!

I honestly don't remember if I ever tried debugging on the iOS simulator. It's been so long now. I would like to assume that I did, though.

You should definitely remove this line from your launch.json file when debugging on the iOS simulator.

"platform": "ios"

This field's only purpose is to make the extension install the app on a device before activating the debugger. Since you are installing manually on the simulator, you don't want to do that.

Because you have "connect": true in your launch.json, you also need "listen": true in your asconfig.json:

"airOptions": {
	"ios_simulator": {
		"listen": true
	}
}

If I did get debugging to work in the iOS simulator, I don't remember if it should use "wi-fi" or "usb" debugging. So, if "connect": true and "listen": true does not work, it might be worth trying with "connect": false and "listen": false too.

Since you are manually installing on the simulator, you probably need to manually launch the app (in case that wasn't obvious). Off the top of my head, I don't remember if you need to start the debugger first, or launch the app first. It may not matter, but it may be worth trying both ways.

If these hints don't get you moving in the right direction, let me know, and I'll try to play around with it myself!

@PrimaryFeather
Copy link
Author

PrimaryFeather commented Jun 25, 2021

Hey Josh,

it's so great to hear from you – yes, it's been such a long time! I really miss the time we were working together on Starling and Feathers. 😄

Your hint was spot-on: After removing the "platform" setting and switching to wi-fi debugging, it immediately worked! For reference (if any other user runs into this), here's my "launch.json" configuration:

{
    "type": "swf",
    "request": "attach",
    "name": "Attach to iOS Simulator",
    "connect": false,
    "preLaunchTask": "Adobe AIR: package iOS simulator debug - asconfig.json"
}

With the pre launch task included, it works like this: start this launch task in VSCode and wait for packaging to complete. Then install the ipa on the simulator (as shown above) and launch it. Et voilà: debugging is working.

Thanks a lot for your help!

BTW, did you ever consider adding a setting like platform: ios_simulator to the launch configurations? I don't know if I'm the only one who likes to use the official simulator from time to time, but it does have its uses, especially for checking things like notch support etc.

Definitely not a high priority – it's also possible to debug manually, as you have shown me. But it might be nice to have! 😄

All the best, Josh! Thanks again!

Cheers,
Daniel

@joshtynjala
Copy link
Member

joshtynjala commented Jun 25, 2021

BTW, did you ever consider adding a setting like platform: ios_simulator to the launch configurations?

I would have expected myself to support that. I wonder if I ran into some technical issues getting it working. Or maybe I was primarily on Windows at the time, so getting something working on macOS that wouldn't work on Windows too was too much of a hassle! 😆 If I find some time to work on the extension, I'll keep this in mind. (I am now primarily on macOS again!)

@PrimaryFeather
Copy link
Author

I would have expected myself to support that.

😆 Haha, yeah, sometimes our past-selves manage to surprise us, right? But if you were mostly on Windows in that time, that makes a lot of sense. It's a pain to work on such a feature and can't even use it yourself, except when moving to a different dev machine.

Don't worry about it – if you find the time, that's fantastic — otherwise I understand, too! 😄 Cheers!

@joshtynjala
Copy link
Member

c9d46d7

It'll be in the next release of vscode-swf-debug, whenever it is that I happen to find time to do one.

@PrimaryFeather
Copy link
Author

OMG, that's incredible, Josh! Thanks so much for investing that time! 😁🙏

@joshtynjala
Copy link
Member

vscode-swf-debug v1.3.0 is now available with support for the ios_simulator platform in launch.json.

@PrimaryFeather
Copy link
Author

PrimaryFeather commented Jul 20, 2021

I just updated the extension and tested debugging on a simulator — and, hurray 🎉!, it works like a charm! Thanks so much for adding this, Josh!

... as for the icing on the cake, or if you're looking for ideas for a future update (haha), one small but useful addition would be to add a property that allows choosing the device to be simulated. Harman recently added the simulator parameter to adt recently, to be used like this: -simulator "iPhone 8". That way, one wouldn't need to rely on the environment variable any longer.

But, again, that's just a small nice-to-have idea for the future – it's FANTASTIC to be able to run the simulator like that, as it is. Thanks again! 😁

@joshtynjala
Copy link
Member

Good idea! I'll keep it in mind for future updates.

@joshtynjala joshtynjala transferred this issue from BowlerHatLLC/vscode-as3mxml Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants