探索M1: 安装iOS版本微信/微信读书
文章内容部分精简自 https://mp.weixin.qq.com/s/TFIcfJjlYU3_nqRC-pPqIA 并补充了开发者角度的思考
玩耍
Apple Configurator 2 点击添加,搜索微信,直到下图“先不要点击”。
如果觉得步骤麻烦,可以改用iMazing软件,能更方便的导出ipa文件。
执行下面的命令复制出ipa文件。
cp ~/Library/Group\ Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/**/*.ipa ~/Downloads
就是从下载的临时文件夹内复制出来
直接打开ipa
由于电脑上已经安装Mac版本微信,刚才的ipa自动重命名为WeChat 2.app
了。
此时还不能打开,执行以下命令:
sudo xattr -rd com.apple.quarantine /Applications/WeChat\ 2.app
打开
双击WeChat 2.app
即可打开。
输入框竟然还可以直接粘贴macOS的屏幕截图。
微信读书
右键菜单还支持。可见苹果考虑的够细致。
原理
首先CPU架构的一致,是一切的前提。其次是苹果官方的支持。
com.apple.quarantine 是什么?
File Quarantine is a new feature in Leopard designed to protect users from trojan horse attacks. It allows applications which download file content from the Internet to place files in “quarantine” to indicate that the file could be from an untrustworthy source. An application quarantines a file simply by assigning values to one or more quarantine properties which preserve information about when and where the file come from.
When the Launch Services API is used to open a quarantined file and the file appears to be an application, script, or other executable file type, Launch Services will display an alert to confirm the user understands the file is some kind of application.
参考:
https://developer.apple.com/library/archive/releasenotes/Carbon/RN-LaunchServices/index.html
沙盒在哪里?
~/Library/Container
苹果就这点考虑的不够健全。本来iOS不越狱情况下是看不了沙盒的。这macOS倒是主动打开了大门。
判断运行在Mac上?
https://stackoverflow.com/questions/65042788/how-to-detect-if-an-ios-app-is-running-on-an-m1-mac https://developer.apple.com/documentation/apple_silicon/running_your_ios_apps_on_macos
只能简单判断下,后续各种AntiXXX自然就会有了。
总结
看来M1的Mac,还有挺多玩法。
由于没找到相关专门的交流群,最后创建了一个M1交流群,欢迎加群:https://t.me/applem1talk (可点击查看原文跳转,需要fq)