12

我刚刚收到一封来自 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 调用的人,这不是一次有趣的冒险。

4

1 回答 1

9

您必须在可执行文件上运行 otool,而不是在应用程序包装器上运行。

例如(抱歉格式怪异):

$ 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)
于 2011-08-11T19:09:51.480 回答