为什么我得到字符串变量的错误?

时间:2016-01-25 18:41:41

标签: ios objective-c sigabrt

我有声明的变量:

import 'dart:mirrors';

Uri get _currentFileUri =>
    (reflect(main) as ClosureMirror).function.location.sourceUri;

void main() { ... }

我在@property(strong, nonatomic) NSString* like_id;

中调用了函数GetLike
- (void)viewDidLoad {}

我收到错误:- (void) GetLike { if(![self.like_id isEqualToString:@""]){ // TODO } }

1 个答案:

答案 0 :(得分:2)

这对我来说很好。

@interface ViewController ()
@property(strong, nonatomic) NSString* like_id;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self getLike];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)getLike {
    if(![self.like_id isEqualToString:@""]){
        NSLog(@"Liked !");
    }
}
@end