我正在用 theos 编译这个调整。我正在尝试在 iPhone 的控制中心内制作一个按钮,按下该按钮会显示联系人列表。我究竟做错了什么?
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
@interface SBAppSliderScrollingViewController : UIViewController
@property (nonatomic, strong) UIButton *button;
-(void)loadView;
@end
%hook SBAppSliderScrollingViewController
-(void)viewDidLoad {
%orig;
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Contacts" forState:UIControlStateNormal];
button.frame = CGRectMake(-25, 7, 150, 37);
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
%new
-(void)buttonPressed:(id)sender {
ABPeoplePickerNavigationController *peoplePicker =
[[ABPeoplePickerNavigationController alloc] init];
peoplePicker.peoplePickerDelegate = self;
[self presentModalViewController:peoplePicker animated:YES];
}
%end
这是我的生成文件:
ARCHS = armv7 arm64
include theos/makefiles/common.mk
TWEAK_NAME = Contacts
Contacts_FILES = Tweak.xm
Contacts_FRAMEWORKS = UIKit
Contacts_FRAMEWORKS = AddressBook
Contacts_FRAMEWORKS = AddressBookUI
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard; killall -9 backboardd"
这是我在使用 theos 编译调整时遇到的错误:
Brandons-Mac:contacts root# make package
Making all for tweak Contacts...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Tweak.xm:26:37: error: assigning to
'id<ABPeoplePickerNavigationControllerDelegate>' from incompatible type
'CKTranscriptCollectionViewController *'
peoplePicker.peoplePickerDelegate = self;
^ ~~~~
1 error generated.
make[2]: *** [obj/Tweak.xm.d559d84f.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [Contacts.all.tweak.variables] Error 2
Brandons-Mac:contacts root#