IOS:XCode 4.6 failed to get the task for process解决方法
2014-09-25 12:39
567 查看
http://blog.csdn.net/annkie/article/details/9564181
在采用真机免证书调试时,一切正常,在编译运行时出现该错误,导致无法attach到debug模式。
搜索了一些网页,最终尝试解决方案如下:
1. 首先在项目下新建一个plist文件。(这一步不是必须,因为下面会自动生成,仅供参考)
New->File->iOS->Resouce->Property List
创建文件Entitlements.plist
打开Entitlements.plist,在空白处右键Add Row增加属性Can be debugged,设为YES
2.创建一个gen_entitlements.py
(这一步OK以后其他项目不需要再重复)
1)
在Terminal命令行下:
sudo mkdir /Applications/Xcode.app/Contents/Developer/iphoneentitlements
cd /Applications/Xcode.app/Contents/Developer/iphoneentitlements
2)新建gen_entitilements.py ,内容如下:
然后修改运行权限:
sudo chmod 777 gen_entitlements.py
[python] view
plaincopy
#!/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()
3.配置Build Phrase (每个项目都需要配置一次)
1)选中项目后,点击Build Phases,在右下方看见Add Build Phase
2)选择Add Build Phase ,然后选择Run Script ,再在shell下的输入框中添加一下内容:
[ruby] view
plaincopy
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 "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
4. 配置Build Settings(每个项目需要配置)
修改targets的build setting属性值。
将Code Signing Entitlements 设为"Entitlements.plist"
将Code Signing Identity中Any iOS SDK设置为iphone Developer,其他则改为Don't Code Sign
5. 保存所有修改,重启XCode,启动项目Run。Debug模式终于可以了,Log也出来了。
以上3,4步骤对每个项目都需要重新设置一次,其他步骤则只需要配置一次。
关于Xcode 4.6 免证书真机调试的内容请搜索"Xcode 4.6 免证书"。
在采用真机免证书调试时,一切正常,在编译运行时出现该错误,导致无法attach到debug模式。
搜索了一些网页,最终尝试解决方案如下:
1. 首先在项目下新建一个plist文件。(这一步不是必须,因为下面会自动生成,仅供参考)
New->File->iOS->Resouce->Property List
创建文件Entitlements.plist
打开Entitlements.plist,在空白处右键Add Row增加属性Can be debugged,设为YES
2.创建一个gen_entitlements.py
(这一步OK以后其他项目不需要再重复)
1)
在Terminal命令行下:
sudo mkdir /Applications/Xcode.app/Contents/Developer/iphoneentitlements
cd /Applications/Xcode.app/Contents/Developer/iphoneentitlements
2)新建gen_entitilements.py ,内容如下:
然后修改运行权限:
sudo chmod 777 gen_entitlements.py
[python] view
plaincopy
#!/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()
3.配置Build Phrase (每个项目都需要配置一次)
1)选中项目后,点击Build Phases,在右下方看见Add Build Phase
2)选择Add Build Phase ,然后选择Run Script ,再在shell下的输入框中添加一下内容:
[ruby] view
plaincopy
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 "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
4. 配置Build Settings(每个项目需要配置)
修改targets的build setting属性值。
将Code Signing Entitlements 设为"Entitlements.plist"
将Code Signing Identity中Any iOS SDK设置为iphone Developer,其他则改为Don't Code Sign
5. 保存所有修改,重启XCode,启动项目Run。Debug模式终于可以了,Log也出来了。
以上3,4步骤对每个项目都需要重新设置一次,其他步骤则只需要配置一次。
关于Xcode 4.6 免证书真机调试的内容请搜索"Xcode 4.6 免证书"。
相关文章推荐
- IOS:XCode 4.6 failed to get the task for process解决方法
- IOS:XCode failed to get the task for process解决方法
- IOS:Xcode 5.0 failed to get the task for process解决方法
- xcode提示: failed to get the task for process 解决方法
- iOS:Xcode错误 failed to get the task for process 3118
- ios在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"解决办法(转)
- Error launching remote program: failed to get the task for process 10722.The解决方法
- 在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"的解决方法
- [xcode]Error launching remote program: failed to get the task for process xxx 本人解决办法
- ios在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"解决办法(转)
- ios在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"解决办法
- 关于iOS 真机不能调试process launch failed: timed out waiting for app to launch 和 failed to get the task for
- failed to get the task for process 1363问题解决
- XCode Could not launch "" failed to get the task for process
- 41.【xcode】错误之Could not launch "" failed to get the task for process
- iOS 真机调试 出现process launch failed: timed out waiting for app to launch 和 failed to get the task for 的
- 【xcode】错误之Could not launch "" failed to get the task for process
- Xcode报错:process Launch Failed:failed to Get the Task for Process 1285(解决方案)
- XCode :failed to get the task for process XXX
- 『IOS』报错:failed to get the task for process XXX(解决方案)