使用越狱 iPhone (Xcode) 进行开发
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10842595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Developing with Jailbroken iPhone (Xcode)
提问by hetelek
I have a jailbroken iPhone 4S with the running iOS 5.1.1. I have Xcode 4.3.2, and I have been able to run my apps to my iPhone, but in a weird way. If I click the debug button on Xcode, it attempts to open the app on my jailbroken iPhone, but fails because it quickly opens and then closes. Even though this happens, if I open the app manually, by clicking it on the homescreen, it runs fine. That's pretty annoying. The most annoying thing is that this causes it to no longer allow debugging, as Xcode doesn't see that it is running.
我有一台越狱的 iPhone 4S,运行 iOS 5.1.1。我有 Xcode 4.3.2,而且我已经能够在我的 iPhone 上运行我的应用程序,但是以一种奇怪的方式。如果我单击 Xcode 上的调试按钮,它会尝试在我越狱的 iPhone 上打开该应用程序,但由于它快速打开然后关闭而失败。即使发生这种情况,如果我手动打开应用程序,通过在主屏幕上单击它,它运行良好。这很烦人。最烦人的是,这导致它不再允许调试,因为 Xcode 看不到它正在运行。
This is the output that it produces:
这是它产生的输出:
error: failed to launch '/Users/hetelek/Library/Developer/Xcode/DerivedData/spyapp-flynnmpiqhjoilezvqsbaqdnkesn/Build/Products/Debug-iphoneos/spyapp.app/spyapp' -- failed to get the task for process 3741
With the process ID changing every time of course.
当然,进程 ID 每次都在变化。
This is the tutorial I used for developing on my jailbroken iDevice: http://iphonedevwiki.net/index.php/Xcode#Developing_without_Provisioning_Profile
这是我在越狱的 iDevice 上开发时使用的教程:http: //iphonedevwiki.net/index.php/Xcode#Developing_without_Provisioning_Profile
Thanks for any help.
谢谢你的帮助。
回答by Andrew R.
I'd try stepping through that tutorial again just to make sure you ran through the setup correctly. It seems like you can install the apps without issue, but the debugger just can't attach to the app after installation. If you really need the debugger, you could try instead opening the app on your device after installation, and then while it's running (and your device is plugged in to your Mac running Xcode), open Xcode and go to Product -> Attach to Process
, and select your app from the list (if it isn't there, that's a whole other issue).
我会尝试再次逐步完成该教程,以确保您正确地完成了设置。看起来您可以毫无问题地安装应用程序,但调试器在安装后无法附加到应用程序。如果您确实需要调试器,您可以尝试在安装后在您的设备上打开应用程序,然后在它运行时(并且您的设备已插入运行 Xcode 的 Mac),打开 Xcode 并转到Product -> Attach to Process
,然后从中选择您的应用程序列表(如果它不存在,那就是另一个问题了)。
Also, try YllierDev's suggestion of enabling get-task-allow
in your app's Entitlements file (if it doesn't have one, you can easily create one from your project's Info page in Xcode). Assuming you went through the tutorial correctly, that should help.
此外,尝试 YllierDev 的建议,get-task-allow
在您的应用程序的权利文件中启用(如果没有,您可以轻松地从 Xcode 中项目的信息页面创建一个)。假设您正确阅读了本教程,那应该会有所帮助。
--
——
To enable the 'get-task-allow' in your app's Entitlements file with Xcode 4.3, do the following:
要使用 Xcode 4.3 在应用程序的权利文件中启用“get-task-allow”,请执行以下操作:
- Click your project under the project navigator, and select the name of your project under the 'Targets' column.
- Next, go to the summary tab, and under 'Entitlements', check 'Enable Entitlements'.
- Next, right click/command click the 'YOURAPP.entitlements' file under the project naviagtor, and select 'Show in Finder'.
Open in in TextEdit, and add:
<key>get-task-allow</key> <true/>
right before
</dict>
.- It should now debug and run fine!
- 在项目导航器下单击您的项目,然后在“目标”列下选择您的项目名称。
- 接下来,转到摘要选项卡,然后在“权利”下,选中“启用权利”。
- 接下来,右键单击/命令单击项目导航器下的“YOURAPP.entitlements”文件,然后选择“在 Finder 中显示”。
在 TextEdit 中打开,并添加:
<key>get-task-allow</key> <true/>
就在之前
</dict>
。- 它现在应该可以调试并运行良好!
回答by egregious
There is a simple answer. The instructions on the iPhoneDevWiki are almost correct. After the write()
to the temp file, you need to flush, else the tempfile is empty. Your ldid3.py should look like this:
有一个简单的答案。iPhoneDevWiki 上的说明几乎是正确的。后write()
到临时文件,你需要冲洗,否则临时文件是空的。您的 ldid3.py 应如下所示:
#!/usr/bin/python
from sys import argv
from subprocess import call, check_call
from os.path import basename, splitext, join
from tempfile import NamedTemporaryFile
app = argv[-1]
obj_path = join(app, splitext(basename(app))[0])
if '-gta' not in argv:
check_call(['/usr/local/bin/ldid', '-S', obj_path])
else:
with NamedTemporaryFile() as f:
f.write("""
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<true/>
</dict>
</plist>\n""")
f.flush()
check_call(['/usr/local/bin/ldid', '-S' + f.name, obj_path])
I have debugging working this way with Xcode 4.3.3 and iOS 5.1.1. This works the way you intended and you'll never have to mess with entitlements for new projects.
我使用 Xcode 4.3.3 和 iOS 5.1.1 以这种方式进行调试。这将按照您的预期工作,您将永远不必为新项目的权利搞得一团糟。
回答by CReaTuS
Try reboot iPhone and Mac. Maybe some process is in background and still is running.
尝试重新启动 iPhone 和 Mac。也许某些进程在后台并且仍在运行。
If is not helps, then Clean a project and do a Full Clean (how do a Full delete)
如果没有帮助,则清理项目并进行完全清理(如何进行完全删除)
Remove from iPhone a app and Rebuild.
从 iPhone 中删除应用程序并重建。
If your app use a self libraries, then rebuild hims too.
如果您的应用程序使用自库,那么也重建他的库。