Objective c 在开始声明时继续使用未声明的标识符
我正在使用ObjC编写一个项目,目前我在正确编译它时遇到了问题,因为未声明的标识符存在错误,尽管我在开始时就将它们放在了一起。我基本上尝试了所有的方法,从新类到不同的变量,有些情况下int会出错,但这是主要问题Objective c 在开始声明时继续使用未声明的标识符,objective-c,jailbreak,Objective C,Jailbreak,我正在使用ObjC编写一个项目,目前我在正确编译它时遇到了问题,因为未声明的标识符存在错误,尽管我在开始时就将它们放在了一起。我基本上尝试了所有的方法,从新类到不同的变量,有些情况下int会出错,但这是主要问题 @interface MPAVRoute : NSObject -(NSString *)productIdentifier; @end @interface BluetoothDevice : NSObject -(int *)batteryLevel; @end @interfa
@interface MPAVRoute : NSObject
-(NSString *)productIdentifier;
@end
@interface BluetoothDevice : NSObject
-(int *)batteryLevel;
@end
@interface SBVolumeControl : NSObject {
float _GetMediaVolumeForIAP;
}
@end
@interface AVVolumeController : NSObject {
float _volume;
}
@end
%hook MPAVRoutingTableViewCell //calls .h file
- (NSString *)_batteryTextForRoute:(MPAVRoute *)route {
int volint = (int) _volume
NSLog(@"%@", [route productIdentifier]);
if([[route productIdentifier] isEqual: @"BTHeadphones76,8206"]) {
int hr = (([batteryLevel]/volint)*5)
double min = (([batteryLevel]%volint)*5)
NSString *hour = [@(hr) stringValue]
NSString *mins = [@(min) stringValue]
NSString *finval = int [batteryLevel]
NSString *strValues = [finval stringByAppendingString:@"%, "
hour: stringByAppendingString:@" hours "
mins: stringByAppendingString:@" minutes remaining."]
return strValues;
}
return %orig;
}
%end
发生的错误如下所示
> Making all for tweak BTTimeRemaining…
==> Preprocessing Tweak.x…
==> Compiling Tweak.x (armv7)…
Tweak.x:22:20: error: use of undeclared identifier '_volume'
int volint = (int) _volume
^
Tweak.x:26:17: error: use of undeclared identifier 'batteryLevel'
int hr = (([batteryLevel]/volint)*5)
^
2 errors generated.
make[3]: *** [/Users/anudeep30/Desktop/bttimeremaining/.theos/obj/debug/armv7/Tweak.x.f89203b0.o]
Error 1
make[2]: *** [/Users/anudeep30/Desktop/bttimeremaining/.theos/obj/debug/armv7/BTTimeRemaining.dylib]
Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [BTTimeRemaining.all.tweak.variables] Error 2
nbp-51-196:bttimeremaining anudeep30$
您很可能需要使用
self.
或self->
。与Swift不同,Objective-C中没有隐含的self
。越狱obj c有点不同,您可以尝试添加*------>int*volint=(int)\u volume