我的应用程序一直很完美地运行,直到昨天。现在,突然间,当我启动应用程序时,与平常连接到我的数据库不同,我的Xcode控制台中会多次出现以下错误:
2018-09-28 22:18:55.376987-0700 [2378:1001370] TIC Read Status [2:0x0]: 1:57 2018-09-28 22:18:56.927081-0700 [2378:1001370] TIC Read Status [3:0x0]: 1:57 2018-09-28 22:18:56.927210-0700 [2378:1001370] TIC Read Status [3:0x0]: 1:57
我绝对不知道为什么-但现在我根本无法登录我的应用程序。您有任何想法为什么会发生这种情况吗?
不是重复问题:答案不可能是“解决方案:只需等待Xcode 9的新版本/更新。” 此外,上述错误正在阻止我的应用程序连接到数据库-其他人报告此错误已经说明它不会影响他们应用程序的性能。
编辑: 这是我如何连接(使用Drupal iOS SDK)。
更新(2018年10月1日):史诗级更新……只要我将DIOSSession从AppDelegate中移到我的初始ViewController中,我就可以像往常一样连接。有人知道为什么吗?我很高兴……但我想在ViewController中这样做而不是在AppDelegate中肯定会有某种后果。
AppDelegate.m
#import "AppDelegate.h"
#import "DIOSSession.h"
#import "AFNetworking.h"
#import "DIOSSystem.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[DIOSSession setupDios];
}
ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
{
// NSLog(@"not first launch");
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
NSDictionary *user = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:@"diosSession"]];
NSString *token = [[NSUserDefaults standardUserDefaults] objectForKey:@"diosToken"];
if (user && token) {
[[DIOSSession sharedSession] setUser:user];
[[DIOSSession sharedSession] setCsrfToken:token];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *yourViewController = (UITabBarController *)[storyboard instantiateViewControllerWithIdentifier:@"tabBar"];
[self.navigationController pushViewController:yourViewController animated:YES];
} else {
NSLog(@"No session present");
}
}
-[NSUserDefaults synchronize]
。根据苹果文档的描述,这个方法是不必要的,不应该被使用。 - Ashley Mills