迁移到 ARC 时出现上述错误。这是代码:
static NSString *cashBalanceKeyPath = @"test";
...
[xxx forKeyPath:cashBalanceKeyPath options:NSKeyValueObservingOptionNew context:&cashBalanceKeyPath];
...
-(void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
if (&cashBalanceKeyPath == context) < error here
{
...
}
当我使用桥接器时:
if (&cashBalanceKeyPath == (__bridge NSString *)context)
我得到了错误:Comparison of distinct pointer types (NSString *__strong* and NSString *)
如何进行转换?提前致谢。