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

[iOS] Set provisioning style for both iPhone Developer and iPhone Distribution to automatic #86748

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

sassanh
Copy link
Contributor

@sassanh sassanh commented Jan 3, 2024

Related: #57195

I think it should work with development certificate by default (both for debug and release builds)
I do have a distribution certificate and yet I keep getting this error: in Signing & Capabilities tab of the target in Xcode:

... is automatically signed for development, but a conflicting code signing identity iPhone Distribution has been manually specified. Set the code signing identity value to "Apple Development" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.

If I replace these two lines in project.pbxproj file:

				CODE_SIGN_IDENTITY = "iPhone Distribution";
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";

to

				CODE_SIGN_IDENTITY = "iPhone Developer";
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

things start to work, you may say you can set it in the Godot export wizard for iOS template, but the thing is as soon as I set a value for code sign identity, the export_plugin.cpp will set CODE_SIGN_STYLE to MANUAL instead of AUTOMATIC and it also causes an error in Xcode build. The only way things work is when CODE_SIGN_STYLE is kept AUTOMATIC and the above lines are changed. so there is no way I'm aware of that I (and I guess the people who commented on that issue and probably others) can get a working export out of the box using the export dialog, and the ipa file generation always fails.

If this PR is not accepted, please explain in details what's going on here, what kind of certificates the developer needs to setup on their machine, what configuration is needed to make it work without this PR merged. If it is not officially documented, it needs to at least be mentioned in a GitHub thread somewhere so that a Google Search finds something. The iOS deployment code is helpful if it works smoothly for people other than the one who implemented it, and it needs documentation for this purpose.

@AThousandShips
Copy link
Member

I don't think there's anything strange with the Developer Vs Disrtribution to me it makes perfect sense to have two different identities in that sense

@bruvzg
Copy link
Member

bruvzg commented Jan 3, 2024

It's probably better to change these two lines to keep mode to automatic for both developer and distribution instead:

bool dbg_manual = !p_preset->get_or_env("application/provisioning_profile_uuid_debug", ENV_IOS_PROFILE_UUID_DEBUG).operator String().is_empty() || (dbg_sign_id != "iPhone Developer");
bool rel_manual = !p_preset->get_or_env("application/provisioning_profile_uuid_release", ENV_IOS_PROFILE_UUID_RELEASE).operator String().is_empty() || (rel_sign_id != "iPhone Distribution");

@sassanh
Copy link
Contributor Author

sassanh commented Jan 3, 2024

I don't think it's a good idea to expect the game developer to have a Distribution certificate when they start testing their app on iPhone. Even a dedicated iPhone developer may not go for a Distribution certificate until the day they want to actually publish their app in app store.
Besides that, I do have a Distribution certificate, but I don't know why I keep getting the above error.

It's probably better to change these two lines to keep mode to automatic for both developer and distribution instead:

It's definitely an improvement, I will do as you said, what about changing the default of release to developer?

@AThousandShips
Copy link
Member

AThousandShips commented Jan 3, 2024

Then just change it? It's not a forced name, the default should be that you use a different identity for release, for security etc., does it not work by changing manually?

The default assumption should be that you do it for production according to general recommendations IMO, much harder to do it wrong by accident (or rather, to realize or remember that, not that you should keep them as is), but still possible to change if you want to do differently

@sassanh
Copy link
Contributor Author

sassanh commented Jan 3, 2024

Then just change it? It's not a forced name, the default should be that you use a different identity for release, for security etc., does it not work by changing manually?

If I change it, then as I mentioned in the original post CODE_SIGN_STYLE becomes MANUAL and Xcode fails to build again, I need to open the project file in an editor or open the Xcode itself to select the profile because it is not selecting it automatically when CODE_SIGN_STYLE is set to MANUAL

That's not what was said though:

That's why I'm asking "what about it?" with a question mark in the end which means other than agreeing with "what is said", I'm suggesting something new which is changing the default for "Code Sign Identity Release" filed to "iPhone Developer" instead of "iPhone Distribution".

The rational behind this suggestion is people may not have created a distribution profile and they may don't know by typing "iPhone Developer" in "Code Sign Identity Release" field.

@AThousandShips
Copy link
Member

AThousandShips commented Jan 3, 2024

That's why I'm asking "what about it?"

I missed a detail and therefore removed that part of my note 🙂

I think the solution, as suggested above, should be to handle that case, not to change the default 🙂

To me it sounds like the check should involve both vases, so it uses automatic for both "Developer" and "Distribution", but keep the default values, that's at least what I'd suggest as a solution here

@sassanh
Copy link
Contributor Author

sassanh commented Jan 3, 2024

I missed a detail and therefore removed that part of my note 🙂

Sorry, I didn't notice you have edited 🙂 Btw I really appreciate your quick responses. So I will just make it keep CODE_SIGN_STYLE automatic for both values.

@AThousandShips
Copy link
Member

No worries, easy to miss 🙂

@sassanh
Copy link
Contributor Author

sassanh commented Jan 8, 2024

I updated this pull request, please review it when you got the time.

@sassanh
Copy link
Contributor Author

sassanh commented Jan 11, 2024

@AThousandShips @bruvzg Sorry to ping you, since last time you responded in less than 5 minutes, I thought maybe you haven't noticed yet PR is updated.

@AThousandShips AThousandShips changed the title Use the same code sign identity for release and debug [iOS] Set provisioning style for both iPhone Developer and iPhone Distribution to automatic Jan 11, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Jan 11, 2024
@akien-mga akien-mga added enhancement cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release and removed discussion needs testing labels Jan 11, 2024
@akien-mga akien-mga merged commit f9762ab into godotengine:master Jan 11, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 11, 2024
@0xafbf
Copy link
Contributor

0xafbf commented Mar 17, 2024

@akien-mga Hello! Sorry to bother, can we get this cherry picked for 3.x too? Thanks!
Edit: I actually made a PR, let me know if I can help in some other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants