すべてのサーバー要求を処理するメソッドに到達可能性関数を実装しました。NSLogsを見ると、関数が完全に機能していることがわかります。ただし、メソッド内に「一時停止」が発生することはありません。つまり、プログラムをクラッシュさせずにUIAlertViewを使用することはできません。
私はこれを完全に間違った方法で行っているかもしれませんが、他に何も見つかりません...
誰かが何らかの方法で表示する通知を取得する方法についてのアイデアを持っていますか?
前もって感謝します
コード:
-(id) getJson:(NSString *)stringurl{
Reachability * reach = [Reachability reachabilityWithHostname:@"www.google.com"];
NSLog(@"reached %d", reach.isReachable);
if (reach.isReachable == NO) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Passwords don't match."
message:@"The passwords did not match. Please try again."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else{
id x =[self getJsonFromHttp:stringurl];
return x;
}
return nil;
}