objective c - Warning - whose view is not in the window hierarchy in IOS 9 -
i created 2 view controllers, viewcontrollerone
, detailviewcontroller
. , gave action uibutton
, when button pressed go second view controller,
- (ibaction)loginbuttonpressed:(uibutton *)sender { self.loginbutton.hidden= yes; self.aview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"authentication.png"]]; lacontext* context = [[lacontext alloc]init]; nserror* error = nil; if ([context canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics error:&error]) { [context evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localizedreason:@"authenticate touch id" reply:^(bool success, nserror*error){ if (success) { dispatch_async(dispatch_get_main_queue(), ^{ self.loginbutton.hidden= no; self.aview.backgroundcolor = [uicolor clearcolor]; detailviewcontroller* detailviewcontroller = [[detailviewcontroller alloc]init]; [self presentviewcontroller:detailviewcontroller animated:yes completion:nil]; }); }
but giving error,
<viewcontroller: 0x7f97e9da7d60> view not in window hierarchy!
when button pressed moves detailviewcontroller
screen black, not showing details in detailviewcontroller
.
if have added detailviewcontroller in storyboard, may have refer same storyboard while instantiating.
uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"your_storyboard_name" bundle: nil]; detailviewcontroller *detailviewcontroller = (detailviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier: @"your_storyboard_identifier"]; [self presentviewcontroller:detailviewcontroller animated:yes completion:nil];
when initiating using alloc/init, it's instantiating blank view controller.
Comments
Post a Comment