iOS 8上的ptrace [英] ptrace on iOS 8

查看:414
本文介绍了iOS 8上的ptrace的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调用 ptrace 上的函数,如此 ptrace(PT_DENY_ATTACH,0,0,0);
但是当我尝试使用 #include< sys / ptrace.h> 导入它时,Xcode会给我一个错误'sys / ptrace.h'找不到文件。我错过了什么,我是否需要导入一个库,或者这在iOS上根本不可用?

I'm trying to call a function on ptrace like thisptrace(PT_DENY_ATTACH, 0, 0, 0); But when I try to import it using #include <sys/ptrace.h>Xcode gives me an error 'sys/ptrace.h' file not found. Am I missing something, do I need to import a library or is this simply unavailable on iOS?

推荐答案

这里的问题是Xcode正在将其SDK基本路径添加到所有系统头路径(例如,/Applications / Xcode.app / Constate / Developer / Printers / iPhoneOS.platform / Developer / SDKs / iPhoneOS9.0.sdk / usr / include /)。不幸的是,ptrace.h不存在,但可以在/ usr / include / sys /中找到。因此,要解决此问题,您需要将include语句更改为:

The problem here is that Xcode is prepending its SDK base path to all system header paths (e.g., /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/include/). Unfortunately, ptrace.h is not there but is found in /usr/include/sys/. So, to solve this, you need to change your include statement to be:

#include </usr/include/sys/ptrace.h>

我不知道为什么ptrace.h不包含在SDK中,而是你正在寻找的功能当它在手机上运行时可以正常工作。

I have no idea why ptrace.h is not included in the SDK but the functionality you're looking for does work when it's running on the phone.

更新虽然这确实允许您使用ptrace功能,但上传到Apple会产生申请被拒绝的原因是:

Update: While this does allow you to use the ptrace functionality, uploading to Apple will result in app rejection due to:

Non-public API usage:

The app references non-public symbols in <app name>: _ptrace

这篇关于iOS 8上的ptrace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆