Showing
1 changed file
with
10 additions
and
8 deletions
... | @@ -4771,14 +4771,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -4771,14 +4771,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
4771 | _httpClient.requestSerializer = [AFJSONRequestSerializer serializer]; | 4771 | _httpClient.requestSerializer = [AFJSONRequestSerializer serializer]; |
4772 | [_httpClient.requestSerializer setTimeoutInterval:30]; | 4772 | [_httpClient.requestSerializer setTimeoutInterval:30]; |
4773 | 4773 | ||
4774 | - [self createDBIfNeeded]; | 4774 | +// [self createDBIfNeeded]; |
4775 | - [self initDBIfNeeded]; | 4775 | +// [self initDBIfNeeded]; |
4776 | - [self restore]; | 4776 | +// [self restore]; |
4777 | + | ||
4777 | //Set HTTP Headers | 4778 | //Set HTTP Headers |
4778 | time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970]; | 4779 | time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970]; |
4779 | // NSString *accessToken = [NSString alloc]; | 4780 | // NSString *accessToken = [NSString alloc]; |
4780 | NSString *accessToken = @""; | 4781 | NSString *accessToken = @""; |
4781 | - if ([_db tableExists:@"requestVariables"] == YES) { | 4782 | + if (([_db open] == YES) && ([_db tableExists:@"requestVariables"] == YES)) { |
4782 | // FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; | 4783 | // FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; |
4783 | // while ([accessTokenSet next]) { | 4784 | // while ([accessTokenSet next]) { |
4784 | // accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; | 4785 | // accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; |
... | @@ -4932,14 +4933,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -4932,14 +4933,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
4932 | _httpClient.requestSerializer = [AFJSONRequestSerializer serializer]; | 4933 | _httpClient.requestSerializer = [AFJSONRequestSerializer serializer]; |
4933 | [_httpClient.requestSerializer setTimeoutInterval:30]; | 4934 | [_httpClient.requestSerializer setTimeoutInterval:30]; |
4934 | 4935 | ||
4935 | - [self createDBIfNeeded]; | 4936 | +// [self createDBIfNeeded]; |
4936 | - [self initDBIfNeeded]; | 4937 | +// [self initDBIfNeeded]; |
4937 | - [self restore]; | 4938 | +// [self restore]; |
4939 | + | ||
4938 | //Set HTTP Headers | 4940 | //Set HTTP Headers |
4939 | time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970]; | 4941 | time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970]; |
4940 | // NSString *accessToken = [NSString alloc]; | 4942 | // NSString *accessToken = [NSString alloc]; |
4941 | NSString *accessToken = @""; | 4943 | NSString *accessToken = @""; |
4942 | - if ([_db tableExists:@"requestVariables"] == YES) { | 4944 | + if (([_db open] == YES) && ([_db tableExists:@"requestVariables"] == YES)) { |
4943 | @try { | 4945 | @try { |
4944 | @synchronized (_DatabaseLock) { | 4946 | @synchronized (_DatabaseLock) { |
4945 | FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; | 4947 | FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; | ... | ... |
-
Please register or login to post a comment