theos踩坑解决

创建依附于设置的APP(preference_bundle_modern)
看完这篇文章,想着实际操作下,没想到又出现一些奇奇怪怪的问题了。

Last login: Fri Jun  3 22:39:20 on ttys000
[email protected] test % nic.pl
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/activator_listener
  [3.] iphone/application_modern
  [4.] iphone/application_swift
  [5.] iphone/control_center_module-11up
  [6.] iphone/cydget
  [7.] iphone/flipswitch_switch
  [8.] iphone/framework
  [9.] iphone/library
  [10.] iphone/notification_center_widget
  [11.] iphone/notification_center_widget-7up
  [12.] iphone/preference_bundle
  [13.] iphone/preference_bundle_swift
  [14.] iphone/theme
  [15.] iphone/tool
  [16.] iphone/tool_swift
  [17.] iphone/tweak
  [18.] iphone/tweak_with_simple_preferences
  [19.] iphone/xpc_service
  [20.] iphone/xpc_service_modern
Choose a Template (required): 12
Project Name (required): test
Package Name [com.yourcompany.test]:   
Author/Maintainer Name [kill]: test
[iphone/preference_bundle] Class name prefix (three or more characters unique to this project) [XXX]: TEST
Instantiating iphone/preference_bundle in test/...
Done.
[email protected] test % cd test
[email protected] test % tree
.
├── Makefile
├── Resources
│   ├── Info.plist
│   ├── Root.plist
│   ├── icon.png
│   ├── [email protected]
│   └── [email protected]
├── TESTRootListController.h
├── TESTRootListController.m
└── layout
    └── Library
        └── PreferenceLoader
            └── Preferences
                └── test.plist

5 directories, 9 files
[email protected] test % make
==> Notice: Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://theos.dev/docs/parallel-building
> Making all for bundle test…
==> Copying resource directories into the bundle wrapper…
==> Compiling TESTRootListController.m (armv7)…
==> Linking bundle test (armv7)…
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/System/Library/PrivateFrameworks'
ld: framework not found Preferences
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Volumes/Data/SourceCode/Test/test/test/.theos/obj/debug/armv7/test.bundle/test] Error 1
make[2]: *** [/Volumes/Data/SourceCode/Test/test/test/.theos/obj/debug/armv7/test.bundle/test] Error 2
make[1]: *** [internal-bundle-all_] Error 2
make: *** [test.all.bundle.variables] Error 2
[email protected] test % 

解决的方法:
下载 sdk
iOS SDK

打开访达,找到前往文件夹输入
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

把下载好的全部丢进去,然后编写 MakeFile 文件

TARGET := iphone:clang:14.5:7.0
ARCHS = arm64 arm64e
include $(THEOS)/makefiles/common.mk

BUNDLE_NAME = test

test_FILES = XXXRootListController.m
test_FRAMEWORKS = UIKit
test_PRIVATE_FRAMEWORKS = Preferences
test_INSTALL_PATH = /Library/PreferenceBundles
test_CFLAGS = -fobjc-arc

include $(THEOS_MAKE_PATH)/bundle.mk

ps:TARGET := iphone:clang:SDK版本:7.0

最后 make 一下就行

1 个赞

不太对。 最新的Private SDK在这里 GitHub - theos/sdks: Patched sdks that include private framework tbds