UIPopoverController dealloc getting called—ARC environment

后端 未结 2 1688
走了就别回头了
走了就别回头了 2021-02-12 14:43

While displaying a popover controller for a second time (after dismissing it and then re-displaying it), I get the following error:

Terminating app due to uncaug

2条回答
  •  花落未央
    2021-02-12 15:13

    I have run into the same problem and fixed it by retaining the popover controller in a strong instance variable as suggested AND explicitly dismissing it before resetting the property with the new popover controller allocated in in the second run of the action. In your example, you should add something like this:

    - (IBAction)createNewScore:(id)sender {
        if (self.pc) {
             [self.pc dismissPopoverAnimated:YES];
        }
    

提交回复
热议问题