안녕하세요 저는 현재 화면에 새보기를 푸시하려고 시도하는 코드 행에 경고를 표시합니다. 개요 // 내 NSObject는 설정 한 내 서버에서 코드 = 1을받습니다. 모든 것이 잘 작동하여 AlertView 메시지의 버튼 클릭을 잡기 위해 if 문을 설정 한 AlertView를 초기화합니다. 버튼을 누르면 응용 프로그램이 넘어집니다.'NSObject'가 -navigationController에 응답하지 않을 수 있습니다.
헤더 파일을 밀어 넣으려고하는 뷰의 ViewController를 선언 했으므로 컴파일 할 때 경고가 표시되지 않습니다.
이 내 NSObject의이다 내가 경고 '경고'를 얻을 어디 코드의 라인을 굵게 한
/////.h
#import <Foundation/Foundation.h>
@interface alerts : NSObject {
}
- (void)pleaseRegisterDevice;
@end
/////.m
#import "alerts.h"
#import "instaCode1_3AppDelegate.h"
#import "RegisterDeviceViewController.h"
@implementation alerts
//use this alert when phone falls out of sync
- (void)pleaseRegisterDevice {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please Register Device"
message:@"click OK to register"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert autorelease];
[alert show];
}
//Catch pleaseRegisterDevice method
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"OK"]) {
NSLog(@"msg from alertView method");
//open new wndow
RegisterDeviceViewController *regViewController = [[RegisterDeviceViewController alloc] init];
//Push it onto the top pf the navigation controller's stack
**[[self navigationController] pushViewController:regViewController animated:YES];**
}
else {
NSLog(@"was not able to push view");
}
}
- (void)dealloc {
[super dealloc];
}
@end
을 만들었습니다 주시면 감사하겠습니다 -navigationController
어떤 도움에 응답하지 않을 수 있습니다.
고맙습니다. 나는 그 문제가이 일과 관련이 있다는 것을 알았지 만, 나의 명백한 경험 부족으로 정확한 세부 사항을 확신 할 수 없었다. 고맙습니다. – tinhead