最有用的一段
1.建立 “钥匙串”
如图,比如家里钥匙串为 “haohao”
创建证书
(1)
[img]http://dl.iteye.com/upload/attachment/0071/5123/ca24e876-7ea8-36f5-9f94-54f9b14b8c30.png[/img]
(2).
[img]http://dl.iteye.com/upload/attachment/0071/5125/b8cb96f8-053e-34ef-8a2f-99358f98d71c.png[/img]
(3)
[img]http://dl.iteye.com/upload/attachment/0071/5127/721caa7f-1ca9-3b10-8d3b-64c7a45ebac0.png[/img]
(4)
后面默认
[img]http://dl.iteye.com/upload/attachment/0071/5129/ac36992a-41d7-395d-bd3b-0cbe750c6265.png[/img]
(5)
[img]http://dl.iteye.com/upload/attachment/0071/5135/18180fcc-aa06-3018-98e6-0619e153fd92.png[/img]
2.xcode选择设备,插入设备
右上角,Organizer
选择设备,并开发者模式
[img]http://dl.iteye.com/upload/attachment/0071/5141/bdd7c4ae-0ebf-3076-ad76-2eaa240da2b6.png[/img]
3.在 中间的设置
build setting 中的
code signing Identiy
中andy ios sdk 设置为 “haohao”
[img]http://dl.iteye.com/upload/attachment/0071/5131/23b1c117-7370-3774-b49a-06858867c1d1.png[/img]
4.在build Phase 中的右下角
Add build Phase
使用Add run shell
如图,shell内容如下 注意这里的“haohao” 为刚才生成的钥匙串的名字
其他的都不变,什么“my.company.”之类的都不变
[img]http://dl.iteye.com/upload/attachment/0071/5137/966e5120-c111-3d50-becd-4f20516aa390.png[/img]
以上内容注意
中需要用到一个python文件生成.xcent文件到app中,
------------
还要设置一下一些,一下这些是借鉴别人的文章
[color=darkred]到
/Users/apple/Library/Developer/Xcode/DerivedData/test1-gmkvwytfnpktwcfdsyetryfgpitk/Build/Products/Debug-iphoneos
目录下找到 test1.app拖拽到itunes,再拖拽出来就变成ipa了,用91或者itunes或者nginx把ipa文件传到iphone上就可以了[/color]
---------
5.生成ipa
到
以上是对这篇文章的修正
http://blog.youkuaiyun.com/stoneson/article/details/7340332
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "ipados" ]; then
/Applications/Xcode.app/Contents/Developer/iphoneentitlements/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
codesign -f -s "haohao" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
1.建立 “钥匙串”
如图,比如家里钥匙串为 “haohao”
创建证书
(1)
[img]http://dl.iteye.com/upload/attachment/0071/5123/ca24e876-7ea8-36f5-9f94-54f9b14b8c30.png[/img]
(2).
[img]http://dl.iteye.com/upload/attachment/0071/5125/b8cb96f8-053e-34ef-8a2f-99358f98d71c.png[/img]
(3)
[img]http://dl.iteye.com/upload/attachment/0071/5127/721caa7f-1ca9-3b10-8d3b-64c7a45ebac0.png[/img]
(4)
后面默认
[img]http://dl.iteye.com/upload/attachment/0071/5129/ac36992a-41d7-395d-bd3b-0cbe750c6265.png[/img]
(5)
[img]http://dl.iteye.com/upload/attachment/0071/5135/18180fcc-aa06-3018-98e6-0619e153fd92.png[/img]
2.xcode选择设备,插入设备
右上角,Organizer
选择设备,并开发者模式
[img]http://dl.iteye.com/upload/attachment/0071/5141/bdd7c4ae-0ebf-3076-ad76-2eaa240da2b6.png[/img]
3.在 中间的设置
build setting 中的
code signing Identiy
中andy ios sdk 设置为 “haohao”
[img]http://dl.iteye.com/upload/attachment/0071/5131/23b1c117-7370-3774-b49a-06858867c1d1.png[/img]
4.在build Phase 中的右下角
Add build Phase
使用Add run shell
如图,shell内容如下 注意这里的“haohao” 为刚才生成的钥匙串的名字
其他的都不变,什么“my.company.”之类的都不变
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "ipados" ]; then
/Applications/Xcode.app/Contents/Developer/iphoneentitlements/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
codesign -f -s "haohao" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
[img]http://dl.iteye.com/upload/attachment/0071/5137/966e5120-c111-3d50-becd-4f20516aa390.png[/img]
以上内容注意
中需要用到一个python文件生成.xcent文件到app中,
apple:test1.app apple$ cat /Applications/Xcode.app/Contents/Developer/iphoneentitlements/gen_entitlements.py
#!/usr/bin/env python
import sys
import struct
if len(sys.argv) != 3:
print "Usage: %s appname dest_file.xcent" % sys.argv[0]
sys.exit(-1)
APPNAME = sys.argv[1]
DEST = sys.argv[2]
if not DEST.endswith('.xml') and not DEST.endswith('.xcent'):
print "Dest must be .xml (for ldid) or .xcent (for codesign)"
sys.exit(-1)
entitlements = """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>%s</string>
<key>get-task-allow</key>
<true/>
</dict>
</plist>
""" % APPNAME
f = open(DEST,'w')
if DEST.endswith('.xcent'):
f.write("\xfa\xde\x71\x71")
f.write(struct.pack('>L', len(entitlements) + 8))
f.write(entitlements)
f.close()
apple:test1.app apple$
------------
还要设置一下一些,一下这些是借鉴别人的文章
apple:Desktop apple$ cat xcode.txt
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
sudo cp SDKSettings.plist SDKSettings.plist.orig
进行编辑
sudo vim SDKSettings.plist
将以下两段中的YES改为NO
<key>CODE_SIGNING_REQUIRED</key>
<string>YES</string>
和
<key>ENTITLEMENTS_REQUIRED</key>
<string>YES</string>
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
sudo cp Info.plist Info.plist.orig
sudo vim Info.plist
将全部的XCiPhoneOSCodeSignContext 修改成 XCCodeSignContext,3处
mkdir /Applications/Xcode.app/Contents/Developer/iphoneentitlements
cd /Applications/Xcode.app/Contents/Developer/iphoneentitlements
curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
mv gen_entitlements.txt gen_entitlements.py
-----------------
sh-3.2# cat gen_entitlements.txt
#!/usr/bin/env python
import sys
import struct
if len(sys.argv) != 3:
print "Usage: %s appname dest_file.xcent" % sys.argv[0]
sys.exit(-1)
APPNAME = sys.argv[1]
DEST = sys.argv[2]
if not DEST.endswith('.xml') and not DEST.endswith('.xcent'):
print "Dest must be .xml (for ldid) or .xcent (for codesign)"
sys.exit(-1)
entitlements = """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>%s</string>
<key>get-task-allow</key>
<true/>
</dict>
</plist>
""" % APPNAME
f = open(DEST,'w')
if DEST.endswith('.xcent'):
f.write("\xfa\xde\x71\x71")
f.write(struct.pack('>L', len(entitlements) + 8))
f.write(entitlements)
f.close()
sh-3.2#
--------------------
sh-3.2# mv gen_entitlements.txt gen_entitlements.py
sh-3.2# ls
gen_entitlements.py
sh-3.2# chmod 777 gen_entitlements.py
看图 把xcode的工程的所有的code sign去掉
----------
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "ipados" ]; then
/Applications/Xcode.app/Contents/Developer/iphoneentitlements/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
codesign -f -s "haohao" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
-------------
[color=darkred]到
/Users/apple/Library/Developer/Xcode/DerivedData/test1-gmkvwytfnpktwcfdsyetryfgpitk/Build/Products/Debug-iphoneos
目录下找到 test1.app拖拽到itunes,再拖拽出来就变成ipa了,用91或者itunes或者nginx把ipa文件传到iphone上就可以了[/color]
---------
5.生成ipa
到
以上是对这篇文章的修正
http://blog.youkuaiyun.com/stoneson/article/details/7340332