【发布时间】:2019-03-05 01:03:20
【问题描述】:
直到昨天,我的应用程序运行良好。现在,突然之间,由于某种原因,当我启动我的应用程序时,我没有像往常一样连接到我的数据库,而是在我的 Xcode 控制台中多次收到以下错误:
2018-09-28 22:18:55.376987-0700 [2378:1001370] TIC 读取状态 [2:0x0]: 1:57 2018-09-28 22:18:56.927081-0700 [2378:1001370] TIC 读取 状态 [3:0x0]:1:57 2018-09-28 22:18:56.927210-0700 [2378:1001370] TIC 读取状态 [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");
}
}
【问题讨论】:
-
@Kerberos 答案不可能是“解决方案:等待 Xcode 9 的更新版本/更新。”此外,上述错误使我的应用无法连接到数据库 - 其他报告此错误的人表示它不会影响他们应用的性能。
-
您是否尝试使用 Postman 或 cURL 请求连接到后端数据库?
-
@Md.IbrahimHassan 请参阅上面的编辑:我是如何连接的。
-
@Brittany 你在使用这个 SDK github.com/elpablo/drupal-ios-sdk
标签: ios objective-c xcode