static NSString * const MSFClientResponseLoggingEnvironmentKey = @"LOG_API_RESPONSES";
static NSString * const MSFAutologinbuggingEnvironmentKey = @"LOGIN_AUTO_DEBUG";
判断环境变量是否设置
if (NSProcessInfo.processInfo.environment[MSFAutologinbuggingEnvironmentKey] != nil) {
if ([self.userDefaults stringForKey:MSFKeychainUsername] &&
[self.userDefaults stringForKey:MSFKeychainPassword]) {
MSFUser *user = [MSFUser userWithServer:MSFUtils.server];
[[MSFClient signInAsUser:user
password:[self.userDefaults stringForKey:MSFKeychainPassword]
phone:[self.userDefaults stringForKey:MSFKeychainUsername]]
subscribeNext:^(MSFClient *client) {
[MSFUtils setHttpClient:client];
}
error:^(NSError *error) {
NSLog(@"%@",error.description);
}];
}
}
开启变量如图