用
// if([seller_type isEqual:[NSNull class]]) {
// if([seller_type isKindOfClass:[NSNull class]]) {
在iOS12上都会闪退
我用的是这个,测试正常
if ([Result isEqualToString:@"<null>"]) {}
NSString *const infoConfig = @"YOYO-Rongcloud";
NSString *const infoConfig_APP_KEY = @"app_key";
//NSString *const infoConfig_CHANNEL = @"CHANNEL";
NSString *appkey = @"";
if([param[@"appkey"] isEqualToString:@""] || param[@"appkey"] == nil){
NSString *path = [[NSBundle mainBundle]pathForResource:@"Info" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
appkey = dict[infoConfig][infoConfig_APP_KEY]; // appkey
}else{
appkey = param[@"appkey"];
}
判断是否有值,再判断是否为true
-(void)initJMessage:(NSDictionary*)options{
NSNumber *isOpenMessageRoaming = @(false);
// if (options[@"isOpenMessageRoaming"]) {
// isOpenMessageRoaming = options[@"isOpenMessageRoaming"];
// }
// 判断是否传参,如果传参再判断是否为true
if ([NSString stringWithFormat:@"%@", options[@"isOpenMessageRoaming"]].boolValue == true) {
isOpenMessageRoaming = @(true);
}
判断options是否为字典,并且判断如果是字典的话,字典里指定的key是否有值,值是否为true
NSNumber *isOpenMessageRoaming = @(false);
// if (options[@"isOpenMessageRoaming"]) {
// isOpenMessageRoaming = options[@"isOpenMessageRoaming"];
// }
// 判断是否传参,如果传参再判断是否为true
if([options isKindOfClass:[NSDictionary class]] && [NSString stringWithFormat:@"%@", options[@"isOpenMessageRoaming"]].boolValue == true){
isOpenMessageRoaming = @(true);
}