由于某种原因,在点击挂钩的按钮时,我会收到错误。在我的HomeviewController中,用户执行一个操作,将新ViewController添加到NavigationController中,并且在此视图中,控制器的视图是包含按钮的较小视图。我reveiwed我的代码,并看着检查员看,看看我是否错过了任何东西,但没有什么奇怪的声音。

是我添加的查看控制器的.h文件:

@property (weak, nonatomic) IBOutlet UIView *popupView;
@property (weak, nonatomic) IBOutlet UIImageView *blurredImageView;
@property (weak, nonatomic) UIImage *blurredImage;

- (void)presentEventEditViewControllerWithEventStore:(EKEventStore*)eventStore;
- (IBAction)addEvent:(id)sender;;
- (IBAction)cancelEvent:(id)sender;
.

当我点击一个按钮而不将ibacts链接到其中任何一个时,没有错误。一旦我链接它们,应用程序就会崩溃并显示以下错误:

p.s。我还在先前的错误中收到以下内容(在取消链接和重新链接之前):

-[OS_xpc_connection cancelEvent:]:
.

更新:

我加载bannerViewController以下方式:

BannerPopUpViewController *BPV = [[BannerPopUpViewController alloc] initWithNibName:@"BannerPopUpViewController" bundle:nil];
    BPV.blurredImage = [self screenshot];
    [self.view.window addSubview:BPV.view];
.

这是我所指的第一个错误,Crashlytics提供:

但是我继续得到的那个,因为我取消了动作并重新链接是下面的:

有帮助吗?

解决方案

当你做的时候:

[self.view.window addSubview:BPV.view];
.

视图由其调真保留(在这种情况下窗口),但没有任何内容保留BPV视图控制器。需要的东西或它会被解除分配,然后每当按下任何按钮时,它会导致呼叫丢弃的对象(打开僵尸以验证)。

通过将其作为智利视图控制器添加它的强大属性来保留BVP。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top