0
我创建使用狄奥一个调整,改变了“滑动解锁”文本自定义字符串无法初始化类型为“BOOL”的变量 - 狄奥
在我Tweak.xm:
%hook SBLockScreenView
- (void)setCustomSlideToUnlockText:(id)unlockText {
NSString *settingsPath = @"/var/mobile/Library/Preferences/com.motion.tweak~prefs.plist";
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
NSString *text = [prefs objectForKey:@"text"];
BOOL enabled = [prefs objectForKey:@"enabled"];
if([text isEqualToString:@""] || text == nil || ![enabled]) {
%orig(unlockText);
}
else if ([enabled]) {
unlockText = text;
%orig(unlockText);
}
}
%end
我与返回错误,当我尝试做包:
error: cannot initialize a variable of type 'BOOL' (aka 'signed char')
with an rvalue of type 'id'
BOOL enabled = [prefs objectForKey:@"enabled"];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我相信[PREF objectForKey:@“启用“] 将会 返回一个NSNumber *类型。 – 2014-10-01 12:51:40
Tim是正确的,因此将其更改为[[prefs objectForKey:@“enabled”] boolValue] – 2014-10-01 12:53:23
@TimEdwards @ŃikeKamstra谢谢你们,我现在返回一个新的错误,当我尝试制作包时: 'Tweak.xm :41:58:error:expected identifier if([text isEqualToString:@“”] || text == nil ||![enabled]){ ^ Tweak.xm:46:18:error:expected identifier else if([enabled]){ ^ – Motion 2014-10-02 05:11:14