查找私有API调用_terminateWithStatus

时间:2011-08-11 19:01:17

标签: iphone xcode cocoa-touch iphone-privateapi

我刚收到Apple发来的一封电子邮件,说我的应用程序因_terminateWithStatus的调用而被拒绝。我在应用程序中有一些框架,并认为可能是罪魁祸首。

我在这里运行otool是我的输出

/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 751.49.0)
/System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 1400.0.0)
/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
/System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 1.0.0, current version 320.15.0)
/System/Library/Frameworks/MapKit.framework/MapKit (compatibility version 1.0.0, current version 14.0.0)
/System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 485.12.7)
/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 379.0.0)
/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 20.0.0)
/System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 370.3.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 150.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.4.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 550.52.0)

我还通过App Scanner运行了应用程序,但是输出中没有显示terminateWithStatus。

有人能指出我找到正确的方向吗?我也看过一些关于使用nm和grep来查找调用的讨论。提前谢谢。

解决:

潜入构建目录后:

AppName/build/AppName.build/Release-iphoneos/AppName.build/Objects-normal/armv6/ 

我跑了:

strings AppName | grep 'terminateWithStatus'

并返回一个结果。经过一番挖掘,我发现GHUnit,测试框架正在进行调用。我删除了框架,重建并再次运行字符串命令,没有任何结果。

我希望这可以帮助其他人搜索私有API调用,这不是一个有趣的冒险。

1 个答案:

答案 0 :(得分:9)

你必须在可执行文件上运行otool,而不是在app包装器上运行。

例如(抱歉格式怪异):

$ otool -L WriteRoom.app/Contents/MacOS/WriteRoom 

WriteRoom.app/Contents/MacOS/WriteRoom (architecture ppc):
    @executable_path/../Frameworks/Blocks.framework/Versions/A/Blocks (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)

WriteRoom.app/Contents/MacOS/WriteRoom (architecture i386):
    @executable_path/../Frameworks/Blocks.framework/Versions/A/Blocks (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)