Fix 'The name for this app is invalid' error

This error is related to App ID creation failure.
App ID name must be an ascii text. It is not allowed to create an App ID with non-ascii text like Chinese, Japanese.
If the name is NOT an ascii text, using bundleID instead.
This commit is contained in:
SoY0ung
2023-05-14 02:55:36 +08:00
parent a9ce0f487d
commit 1c0d0be622

View File

@@ -268,8 +268,17 @@ extension FetchProvisioningProfilesOperation
}
}
}
//App ID name must be ascii. If the name is not ascii, using bundleID instead
let appIDName: String
if containsNonASCII(text: name) {
//Contains non ASCII (Such as Chinese/Japanese...), using bundleID
appIDName = bundleIdentifier
}else {
//ASCII text, keep going as usual
appIDName = name
}
ALTAppleAPI.shared.addAppID(withName: name, bundleIdentifier: bundleIdentifier, team: team, session: session) { (appID, error) in
ALTAppleAPI.shared.addAppID(withName: appIDName, bundleIdentifier: bundleIdentifier, team: team, session: session) { (appID, error) in
do
{
do
@@ -514,3 +523,13 @@ extension FetchProvisioningProfilesOperation
}
}
}
func containsNonASCII(text: String) -> Bool {
let ascii = CharacterSet(charactersIn: "\0"..."~")
for scalar in text.unicodeScalars {
if !ascii.contains(scalar) {
return true
}
}
return false
}