简体   繁体   English

如何使用PHP创建IPA文件

[英]How to create ipa file using php

I am trying to run shell script from php file to build and archive the ios application. 我正在尝试从php文件运行shell脚本以构建和归档ios应用程序。 Here is what i have done so far 这是我到目前为止所做的

In my test.php file i have written below code: 在我的test.php文件中,我编写了以下代码:

<?php
    echo shell_exec("sh build.sh");
?>

In build.sh i have written: 在build.sh中,我写了:

PROJDIR="/Library/WebServer/Documents/ExpertIPA/IPA/MyApp"
PROJECT_NAME="MyApp"
APPLICATION_NAME="MyApp"
TARGET_SDK="iphonesimulator6.0"
PROJECT_BUILDDIR="${PROJDIR}/build/Release-iphoneos"
TARGET_TEST_NAME="ExpertApp"
BUILD_HISTORY_DIR="${PROJDIR}/ipa/" #where you want the .ipa to go
DEVELOPER_NAME="iPhone Distribution: developer Name"
PROVISONING_PROFILE="/Library/WebServer/Documents/ExpertIPA/IPA/ExpertApp/
MyApp_distribution.mobileprovision"


echo Building Project
cd "${PROJDIR}"
build_type_iOS=$2


xcodebuild clean -configuration "${build_type_iOS}"
xcodebuild -target "${PROJECT_NAME}"  -configuration Release


if [ $? != 0 ]
then
   exit 1
fi

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa"  --embed "${PROVISONING_PROFILE}"

when i running my build.sh file from terminal it creates MyApp.ipa successfully, also when i am running test.php on mac terminal its working fine, but when i am running test.php from browser it gives following error message. 当我从终端运行build.sh文件时,它成功创建了MyApp.ipa,同时当我在Mac终端上运行test.php时,它也能正常工作,但是当我从浏览器运行test.php时,它给出了以下错误消息。

Error message: 错误信息:

BUILD NATIVE TARGET MyApp OF PROJECT MyApp WITH CONFIGURATION Release === Check dependencies Code Sign error: The identity 'iPhone Distribution: Profile_Name' doesn't match any valid, non-expired certificate/private key pair in your keychains 构建带有配置的项目MyApp的本地目标MyApp版本===检查依赖项代码签名错误:身份'iPhone Distribution:Profile_Name'与您的钥匙串中任何有效的,未过期的证书/私钥对不匹配

The private key & cert xcodebuild is looking for are generally stored in your keychain. 寻找的私钥和证书xcodebuild通常存储在您的钥匙串中。 When you're logged in as yourself you can see your keychain with the Keychain Access GUI. 当您以自己的身份登录时,可以通过“钥匙串访问” GUI看到钥匙串。 Use that GUI to export the cert and private key. 使用该GUI导出证书和私钥。

Then look into using the 'security' command line tool to import the private key & certificate pair that xcodebuild is looking for into the keychain for the _www user. 然后研究使用“安全性”命令行工具将xcodebuild正在寻找的私钥和证书对导入_www用户的钥匙串中。 You may have to actually create a keychain for the _www user (I've only ever done builds with a normal user that you can login as). 您可能必须为_www用户实际创建一个钥匙串(我只用可以登录的普通用户来完成构建)。

我认为它查找~/.ssh/id_rsa类的东西,并且当您从浏览器(用户wwwwww-data )运行时找不到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM