mirror of
https://git.sr.ht/~eliasnaur/gio-cmd
synced 2026-07-01 07:35:37 +00:00
gogio: [iOS] fix compatibility with Apple Connect and iPad requirement
This pach fixes a total of 6 issues caused by gogio, when uploading .ipa to Apple Connect/Apple Store. 1. Asset validation failed (90474), caused by not set "UIInterfaceOrientationPortraitUpside" in plist. 2. Asset validation failed (90482), the executable contains bitcode. Now, gogio will use "bitcode_strip" to remove such bitcode. 3. Asset validation failed (90060), the version can only have three non-negative numbers. Using values from semVer is invalid (such as 1.2.3.4), it must be either 1.2.3 or 1.2.34. Now, gogio uses the later one. 4. Asset validation failed (90476), supporting multitask on iPad requires UILaunchScreen. That is tricky to solve, instead gogio will NOT support multitask on iPad. 5. Asset validation failed (90208), version mismatch between plist and binary. Now, gogio will use compile flags to set the version AND will use the proper minSdk on plist. 6. Asset validation failed (90023), missing 152x152 icon for iPad. Now, gogio will create such icon. Signed-off-by: inkeliz <inkeliz@inkeliz.com> Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -94,6 +94,11 @@ func (s Semver) String() string {
|
|||||||
return fmt.Sprintf("%d.%d.%d.%d", s.Major, s.Minor, s.Patch, s.VersionCode)
|
return fmt.Sprintf("%d.%d.%d.%d", s.Major, s.Minor, s.Patch, s.VersionCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s Semver) StringCompact() string {
|
||||||
|
// Used to meet CFBundleShortVersionString format.
|
||||||
|
return fmt.Sprintf("%d.%d.%d", s.Major, s.Minor, s.Patch)
|
||||||
|
}
|
||||||
|
|
||||||
func parseSemver(v string) (Semver, error) {
|
func parseSemver(v string) (Semver, error) {
|
||||||
var sv Semver
|
var sv Semver
|
||||||
_, err := fmt.Sscanf(v, "%d.%d.%d.%d", &sv.Major, &sv.Minor, &sv.Patch, &sv.VersionCode)
|
_, err := fmt.Sscanf(v, "%d.%d.%d.%d", &sv.Major, &sv.Minor, &sv.Patch, &sv.VersionCode)
|
||||||
|
|||||||
+50
-24
@@ -202,6 +202,7 @@ func exeIOS(tmpDir, target, app string, bi *buildInfo) error {
|
|||||||
}
|
}
|
||||||
cflags = append(cflags,
|
cflags = append(cflags,
|
||||||
"-fobjc-arc",
|
"-fobjc-arc",
|
||||||
|
fmt.Sprintf("-miphoneos-version-min=%d.0", bi.minsdk),
|
||||||
)
|
)
|
||||||
cflagsLine := strings.Join(cflags, " ")
|
cflagsLine := strings.Join(cflags, " ")
|
||||||
exeSlice := filepath.Join(tmpDir, "app-"+a)
|
exeSlice := filepath.Join(tmpDir, "app-"+a)
|
||||||
@@ -271,6 +272,9 @@ func iosIcons(bi *buildInfo, tmpDir, appDir, icon string) (string, error) {
|
|||||||
err := buildIcons(appIcon, icon, []iconVariant{
|
err := buildIcons(appIcon, icon, []iconVariant{
|
||||||
{path: "ios_2x.png", size: 120},
|
{path: "ios_2x.png", size: 120},
|
||||||
{path: "ios_3x.png", size: 180},
|
{path: "ios_3x.png", size: 180},
|
||||||
|
{path: "ipad_1x.png", size: 76},
|
||||||
|
{path: "ipad_2x.png", size: 152},
|
||||||
|
{path: "ipad_4x.png", size: 228},
|
||||||
// The App Store icon is not allowed to contain
|
// The App Store icon is not allowed to contain
|
||||||
// transparent pixels.
|
// transparent pixels.
|
||||||
{path: "ios_store.png", size: 1024, fill: true},
|
{path: "ios_store.png", size: 1024, fill: true},
|
||||||
@@ -279,26 +283,44 @@ func iosIcons(bi *buildInfo, tmpDir, appDir, icon string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
contentJson := `{
|
contentJson := `{
|
||||||
"images" : [
|
"images": [
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size": "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "ios_2x.png",
|
"filename": "ios_2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size": "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "ios_3x.png",
|
"filename": "ios_3x.png",
|
||||||
"scale" : "3x"
|
"scale": "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "1024x1024",
|
"size": "76x76",
|
||||||
"idiom" : "ios-marketing",
|
"idiom": "ipad",
|
||||||
"filename" : "ios_store.png",
|
"filename": "ipad_1x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"size": "76x76",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "ipad_2x.png",
|
||||||
|
"scale": "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size": "152x152",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "ipad_4x.png",
|
||||||
|
"scale": "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size": "1024x1024",
|
||||||
|
"idiom": "ios-marketing",
|
||||||
|
"filename": "ios_store.png",
|
||||||
|
"scale": "1x"
|
||||||
|
}
|
||||||
|
]
|
||||||
}`
|
}`
|
||||||
contentFile := filepath.Join(appIcon, "Contents.json")
|
contentFile := filepath.Join(appIcon, "Contents.json")
|
||||||
if err := os.WriteFile(contentFile, []byte(contentJson), 0o600); err != nil {
|
if err := os.WriteFile(contentFile, []byte(contentJson), 0o600); err != nil {
|
||||||
@@ -345,10 +367,10 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
}{
|
}{
|
||||||
AppName: appName,
|
AppName: appName,
|
||||||
AppID: bi.appID,
|
AppID: bi.appID,
|
||||||
Version: bi.version.String(),
|
Version: bi.version.StringCompact(),
|
||||||
VersionCode: bi.version.VersionCode,
|
VersionCode: bi.version.VersionCode,
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
MinVersion: minIOSVersion,
|
MinVersion: bi.minsdk,
|
||||||
SupportPlatform: supportPlatform,
|
SupportPlatform: supportPlatform,
|
||||||
Schemes: bi.schemes,
|
Schemes: bi.schemes,
|
||||||
}
|
}
|
||||||
@@ -382,7 +404,7 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
<key>DTPlatformVersion</key>
|
<key>DTPlatformVersion</key>
|
||||||
<string>12.4</string>
|
<string>12.4</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>{{.MinVersion}}</string>
|
<string>{{.MinVersion}}.0</string>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
@@ -395,9 +417,12 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIRequiresFullScreen</key>
|
||||||
|
<true/>
|
||||||
<key>DTCompiler</key>
|
<key>DTCompiler</key>
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||||
<key>DTPlatformBuild</key>
|
<key>DTPlatformBuild</key>
|
||||||
@@ -410,6 +435,8 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
<string>1030</string>
|
<string>1030</string>
|
||||||
<key>DTXcodeBuild</key>
|
<key>DTXcodeBuild</key>
|
||||||
<string>10G8</string>
|
<string>10G8</string>
|
||||||
|
<key>UILaunchScreen</key>
|
||||||
|
<true/>
|
||||||
{{if .Schemes}}
|
{{if .Schemes}}
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
<array>
|
<array>
|
||||||
@@ -575,7 +602,6 @@ func iosCompilerFor(target, arch string, minsdk int) (string, []string, error) {
|
|||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
cflags := []string{
|
cflags := []string{
|
||||||
"-fembed-bitcode",
|
|
||||||
"-arch", allArchs[arch].iosArch,
|
"-arch", allArchs[arch].iosArch,
|
||||||
"-isysroot", sdkPath,
|
"-isysroot", sdkPath,
|
||||||
"-m" + platformOS + "-version-min=" + strconv.Itoa(minsdk),
|
"-m" + platformOS + "-version-min=" + strconv.Itoa(minsdk),
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ var (
|
|||||||
destPath = flag.String("o", "", "output file or directory.\nFor -target ios or tvos, use the .app suffix to target simulators.")
|
destPath = flag.String("o", "", "output file or directory.\nFor -target ios or tvos, use the .app suffix to target simulators.")
|
||||||
appID = flag.String("appid", "", "app identifier (for -buildmode=exe)")
|
appID = flag.String("appid", "", "app identifier (for -buildmode=exe)")
|
||||||
name = flag.String("name", "", "app name (for -buildmode=exe)")
|
name = flag.String("name", "", "app name (for -buildmode=exe)")
|
||||||
version = flag.String("version", "1.0.0.1", "semver app version (for -buildmode=exe) on the form major.minor.patch.versioncode")
|
version = flag.String("version", "1.0.0.1", "semver app version (for -buildmode=exe) on the form major.minor.patch.versioncode. The versioncode is not used for iOS and macOS.")
|
||||||
printCommands = flag.Bool("x", false, "print the commands")
|
printCommands = flag.Bool("x", false, "print the commands")
|
||||||
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
|
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
|
||||||
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
|
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
|
||||||
|
|||||||
Reference in New Issue
Block a user