2016-03-30 10 views
0

Xcodeで作業していて、既存のアプリケーションを修正しようとするのが初めてです。私が抱えている問題は、HTMLファイルをモーダルウィンドウに読み込むことです。モーダルウィンドウの読み込み中にアプリケーションがクラッシュする

これは、私が思うのコードでは、関連性がある:

-(void) loadScreen 
{ 
    [super loadScreen]; 


    formView = [[ontracHazardsFormSheetViewController alloc] init]; 
    [formView setModalPresentationStyle:UIModalPresentationFormSheet]; 
    formView.urlToLoad = [self.urlToLoadstringByAppendingString:@"/redzone"]; 
    formView.cookieValue = self.cookieValue; 
    formView.dataObject = self.dataObject; 
    formView.htmlString = self.redzoneHTMLString; 
    [formView loadScreen]; 


} 
- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view from its nib. 


    NSMutableArray *array = [self.navigationItem.rightBarButtonItems mutableCopy]; 

    UIBarButtonItem *redZoneButton = [[UIBarButtonItem alloc] initWithTitle:@"Red Zones" style:UIBarButtonItemStylePlain target:self action:@selector(displayRedZones:)]; 
    redZoneButton.tintColor = [UIColor redColor]; 
    [array addObject:redZoneButton]; 
    self.navigationItem.rightBarButtonItems = array; 

} 
-(IBAction)displayRedZones:(id)sender 
{ 
    NSLog(@"red zones"); 


    [self presentViewController:formView animated:NO completion:nil]; 


    //ontracWebViewController 

} 

私はdisplayRedZonesを起動し、私はそれを使用する場合は、次のクラッシュレポートが生成されるボタンがあります。

2016-03-30 14:05:55.539 eCoss[3680:1292033] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[_UIAlertControllerActionSheetRegularPresentationController _defaultAnimationController]: unrecognized selector sent to instance 0x15710d10' 
*** First throw call stack: 
(0x2265c10b 0x21e02e17 0x22661925 0x2265f559 0x2258fc08 0x26b05e03 0x267a7651 0x26b05d69 0x2689a979 0x268c631d 0x268c50b1 0x22e697bd 0x2261fe1f 0x2261fa51 0x2261d89d 0x22570bf9 0x225709e5 0x237bcac9 0x26800ba1 0xd1ac1 0x2221f873) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

Xcodeはまた、これを示しますアプリがクラッシュしたとき:

enter image description here

私が言ったように、私はXcodeとIOS開発の完全な停止を使用することに全く新しいので、重要なものを含めていない場合は、私を許して知らせてください。コードの下

おかげ

+2

Xcodeがクラッシュしていますか、アプリがクラッシュしていますか? – trojanfoe

+0

アプリ、Xcodeは細かい – jampez77

+2

あなたの質問のタイトルを修正してください。 – trojanfoe

答えて

1

用途:iPhone用

:iPadのために

[self presentViewController: formView animated:YES completion:nil]; 

UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:formView]; 

    [popup presentPopoverFromRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

と同様に、

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 
    [self presentViewController:formView animated:YES completion:nil]; 
} 
else { 
    // Change Rect to position Popover 
    UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:formView]; 
    [popup presentPopoverFromRect:CGRectMakeCGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
} 

注:reqiurementに従って変更を行います。

+0

これは、 – jampez77

関連する問題