简体   繁体   English

检测iOS App是否是用Swift编写的

[英]Detect if iOS App is written in Swift

Im developing a tool that tries to dump header classes for a jailbroken device on an App. 我开发了一个工具,试图在App上转储越狱设备的头类。 I'm using Clutch , but sometimes Clutch fails to some newer apps, I'm thinking of integrating some tools other than Clutch. 我正在使用Clutch ,但有时Clutch无法使用一些较新的应用程序,我正在考虑集成Clutch以外的一些工具。 So, I need to determine at first if the binary is written in Swift, so that I can switch to the right tool to execute. 因此,我首先需要确定二进制文件是否是用Swift编写的,这样我就可以切换到正确的工具来执行。

My question is, Is there a way, like a command tool to determine if an iOS App Binary is written in Swift? 我的问题是, 有没有办法,比如命令工具来确定iOS App二进制文件是否是用Swift编写的? Is there really much difference in how the binary is built when it's in Swift compare to just Obj-C? 与只有Obj-C相比,在Swift中构建二进制文件的方式真的有很大不同吗?

Inside the .app file there is a _CodeSignature folder. 在.app文件中有一个_CodeSignature文件夹。 Inside there is a CodeResources file. 里面有一个CodeResources文件。 If you open that as text you will see that it contains Frameworks/libswiftCore.dylib 如果你打开它作为文本,你会看到它包含Frameworks/libswiftCore.dylib

I believe this indicates that it has been built with swift. 我相信这表明它是用swift构建的。

You can use nm tool to print app symbol table. 您可以使用nm工具打印应用程序符号表。 If you search for swift , for example using grep : 如果你搜索swift ,例如使用grep

nm YourApp | grep swift

It will print something like this (and many more): 它会打印这样的东西(以及更多):

U __swift_FORCE_LOAD_$_swiftFoundation

For an 100% Objective-C app the result will be empty. 对于100%Objective-C应用程序,结果将为空。 However, you can't tell if the code is 100% Swift because for mixed objc + swift apps the result will be similar to a swift app. 但是,您无法判断代码是否为100%Swift,因为对于混合的objc + swift应用程序,结果将类似于swift应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在用Swift编写的iOS应用中实现Shopify - Implement Shopify in iOS app written in Swift 检测应用程序是否从后台 Swift iOS 打开 - Detect if app is opened from Background Swift iOS iOS Swift - 如何在应用程序中检测系统警报 - iOS Swift - How to detect system Alarm in app 快速视图中编写的iOS应用程序在返回视图时崩溃 - iOS app written in swift is crashing when returning to a view 将UIButton放置在iOS应用程序的UITextView中的文本末尾,该应用程序以Swift编写的Xcode - Place UIButton at the end of text in UITextView in iOS app in Xcode written in Swift Swift - 如何在 iOS 应用中检测 CarPlay 的连接/断开状态? - Swift - How to detect CarPlay's connect/Disconnect status in iOS app? 让 iOS 应用程序检测用户是否尝试呼叫 Siri - swift - Make iOS app detect if user is trying to call for Siri - swift 如何将 watchOS Swift 目标添加到用 Objective-C 编写的 iOS 应用程序 - How to add a watchOS Swift target to an iOS app written in Objective-C 如何使用由Swift编写的Xcode中的TabBarController管理的ViewController处理iOS应用程序的静态QuickAction - How to handle static QuickActions for iOS app using ViewControllers managed by a TabBarController in Xcode written in Swift 由于版本较低错误,无法在设备上启动用 Swift 编写的 iOS 应用程序 - Unable to launch iOS app written in Swift on device due to lower version error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM