Presenting view controller modally crashes app due to low memory

时间:2015-07-28 22:41:06

标签: ios xcode xcode7 ios9

I'm trying to get my app ready for iOS 9 and I'm experiencing a crash that it can't figure out how to fix. I'm running Xcode 7 beta 4, and iOS 9 public beta 2.

I'm presenting a view controller modally through a segue trigged by an action in the storyboard.

prepareForSegue:sender looks like this

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"AddSnapshot"]) {
        UINavigationController *nav = (UINavigationController *)segue.destinationViewController;
        AddSnapshotTableViewController *add =
            (AddSnapshotTableViewController *)nav.topViewController;
        Snapshot *snapshot = [Snapshot newManagedObject];
        [self.move addSnapshotsObject:snapshot];
        snapshot.move = self.move;
        add.currentSnapshot = snapshot;
        add.delegate = self;
    }
}

Before presenting the view controller the app crashes with this in the log:

TenMoves(2317,0x19eb4f000) malloc: *** mach_vm_map(size=1048576) failed (error code=3)
*** error: can't allocate region securely
*** set a breakpoint in malloc_error_break to debug

I've tried to profile the app using Instruments and seems something inside CoreAnimation is allocating memory in an infinite loop.

The same issue is not present in the simulator, however it does the same when I dismiss another modal view controller presented in another scene of the app. Again CoreAnimation...

The source code for the app can be found here.

0 个答案:

没有答案