What are these errors and how to find out these errors. In my app I am using GoogleAnalytics, Fabric, Mix panel, Core Data and I am sending parameters to the server and getting data from the server.
这些错误是什么以及如何找出这些错误。在我的应用程序中,我使用的是GoogleAnalytics,Fabric,Mix面板,Core Data,我正在向服务器发送参数并从服务器获取数据。
This is my code:
这是我的代码:
- (IBAction)searchButton:(id)sender {
if (sender == self.searchButton) {
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
UIAlertController * alert = [UIAlertController alertControllerWithTitle : @"Message"
message : @"No Internet!Please Connect and try again."
preferredStyle : UIAlertControllerStyleAlert];
UIAlertAction * ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{ }];
[alert addAction:ok];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alert animated:YES completion:nil];
});
// NSLog(@"There IS NO internet connection");
} else {
if ([self.selectOptionButton.currentTitle isEqualToString:@"Select Your Option"]) {
UIAlertController * alert = [UIAlertController alertControllerWithTitle : @"Message"
message : @"Please select option."
preferredStyle : UIAlertControllerStyleAlert];
UIAlertAction * ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{ }];
[alert addAction:ok];
[self presentViewController:alert animated:YES completion:nil];
} else if ([self.textField.text isEqualToString:@""]) {
UIAlertController * alert = [UIAlertController alertControllerWithTitle : @"Message"
message : @"Please enter number."
preferredStyle : UIAlertControllerStyleAlert];
UIAlertAction * ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{ }];
[alert addAction:ok];
[self presentViewController:alert animated:YES completion:nil];
} else {
NSString * key1 = @"Something";
NSString * key2 = @"Something";
NSString * key3;
if ([self.optionButton.currentTitle isEqualToString:@"No0"]) {
key3 = @"0";
} else if ([self.optionButton.currentTitle isEqualToString:@"No1"]) {
key3 = @"1";
} else if ([self.optionButton.currentTitle isEqualToString:@"No2"]) {
key3 = @"2";
} else if ([self.optionButton.currentTitle isEqualToString:@"No3"]) {
key3 = @"3";
} else if ([self.optionButton.currentTitle isEqualToString:@"No4"]) {
key3 = @"4";
}
NSString * str;
NSArray * arr = [NSArray arrayWithObjects:self.key4, key1, key2, self.textField.text, key3, self.systemDateTime, self.key5, self.key6, nil];
str = [arr componentsJoinedByString:@"~"];
self.tempURLString = [[NSString alloc] initWithFormat:@"http://hostname/%@.php?da=%@", self.string, str];
//Getting data from server through JSON approach ...
self.urlSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
self.urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:self.tempURLString]];
self.dataTask = [self.urlSession dataTaskWithRequest:self.urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSMutableDictionary *serverRes = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
self.integer = [[serverRes objectForKey:@"str"] count];
if (!(error == nil)) {
UIAlertController * alert = [UIAlertController alertControllerWithTitle : [error localizedDescription]
message : [error localizedRecoverySuggestion]
preferredStyle : UIAlertControllerStyleAlert];
UIAlertAction * ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{ }];
[alert addAction:ok];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alert animated:YES completion:nil];
});
// NSLog(@"%@", error);
} else {
if (serverRes == nil || self.integer == 0) {
UIAlertController * alert = [UIAlertController alertControllerWithTitle : @"Message"
message : @"Please enter valid number."
preferredStyle : UIAlertControllerStyleAlert];
UIAlertAction * ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{ }];
[alert addAction:ok];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alert animated:YES completion:nil];
});
// NSLog(@"Data Nil.....");
} else {
[self.array1 removeAllObjects];
[self.array2 removeAllObjects];
[self.array3 removeAllObjects];
[self.array4 removeAllObjects];
[self.array5 removeAllObjects];
[self.array6 removeAllObjects];
[self.array7 removeAllObjects];
[self.array8 removeAllObjects];
[self.array9 removeAllObjects];
[self.array10 removeAllObjects];
for (int i=0; i<self.integer; i++) {
[self.array1 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str1"]];
[self.array2 addObject:[[[serverRes objectForKey:@"sStr"] objectAtIndex:i] objectForKey:@"str2"]];
[self.array3 addObject:[[[serverRes objectForKey:@"sStr"] objectAtIndex:i] objectForKey:@"str3"]];
[self.array4 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str4"]];
[self.array5 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str5"]];
[self.array6 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str6"]];
[self.array7 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str7"]];
[self.array8 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str8"]];
[self.array9 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str9"]];
[self.array10 addObject:[[[serverRes objectForKey:@"str"] objectAtIndex:i] objectForKey:@"str10"]];
}
//Reload tableView Data...
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
}
}];
[self.dataTask resume];
}
}
}
}
错误是......
What is the exact meaning of these error and how to solve these errors?
这些错误的确切含义是什么以及如何解决这些错误?