1
요청이 일정 기간 후 시간 초과되었는지 확인하고 싶습니다.요청 시간이 초과되었는지 확인하는 방법은 설정할 수있는 알림이 있습니까?
NSNotifiactionCenter를 알고 있지만 요청 시간 초과 알림을 설정하는 방법을 알지 못합니다.
감사합니다.
요청이 일정 기간 후 시간 초과되었는지 확인하고 싶습니다.요청 시간이 초과되었는지 확인하는 방법은 설정할 수있는 알림이 있습니까?
NSNotifiactionCenter를 알고 있지만 요청 시간 초과 알림을 설정하는 방법을 알지 못합니다.
감사합니다.
타이머를 사용하고 그때까지 수신되지 않으면 알림 요청을 취소 할 수 있습니까?
애플의 접근 가능성 예제 :
- (void) startNotifier
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReachabilityChanged:) name:@"kNetworkReachabilityChangedNotification" object:nil];
notified = NO;
[self performSelector:@selector(onRequestTimeout) withObject:nil afterDelay:5.0]; // 5 secs
}
- (void)onReachabilityChanged:(NSNotification *)note
{
// Do whatever on notification
notified = YES;
}
- (void) onRequestTimeout
{
if (!notified)
{
// Do whatever on request timeout
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"kNetworkReachabilityChangedNotification" object:nil];
}
}