我在BLEObject.m
文件中调用UnityBridge.mm
中的方法。
BLEObject.m
有
- (void) SendSetting:(NSData*)data forSelected:(NSString*)type with:(NSData*)clublength and:(NSData*)clubloft{
}
UnityBridge.mm
有
void bleplugin_sendSetting(unsigned char data, char* type, float clublength, float clubloft)
{
BLEObject *bleobj = [[BLEObject alloc] init];
//NSString* objcstring = @(type);
NSString* string = [NSString stringWithUTF8String:type];
NSData *data_ = [NSData dataWithBytes: &data length: sizeof(data)];
NSData *clublength_ = [NSData dataWithBytes: &clublength length: sizeof(clublength)];
NSData *clubloft_ = [NSData dataWithBytes: &clubloft length: sizeof(clubloft)];
[bleobj SendSetting:data_ forSelected:string with:clublength_ and:clubloft_];
return;
}
我有一个错误;
[bleobj SendSetting:data_ forSelected:string with:clublength_ and:clubloft_];
具有预期的表达式,如下图所示:
and
是C ++中的关键字;它在语法上和你写&&
一样。 (类似地,对于or
||
,not
为!
,not_eq
为!=
,bitand
为&
,bitor
为|
,xor
为^
,compl
为~
,and_eq
为&=
,or_eq
为|=
,和xor_eq
为^=
)。
因此,在使用C ++时,应避免使用具有此类名称的任何标识符。