我收到了一堆崩溃报告,看起来很像下面这个范围的不同值.有时范围不是0-x,可以说是2-x
特定于应用程序的信息:*由于未捕获的异常终止应用程序\'NSRangeException \',原因:\'* - [NSBigMutableString substringWithRange:]:范围{0,69}超出范围; 字符串长度0 \'
Last Exception Backtrace:
0 CoreFoundation 0x2e879e83 __exceptionPreprocess + 131
1 libobjc.A.dylib 0x38bd66c7 objc_exception_throw + 38
2 CoreFoundation 0x2e879dc5 +[NSException raise:format:] + 112
3 Foundation 0x2f1a1bd1 -[NSString substringWithRange:] + 120
4 UIKit 0x311b2815 -[NSTextStorage(UIKitUndoExtensions) _undoRedoAttributedSubstringFromRange:] + 132
5 UIKit 0x315d9679 -[_UITextUndoOperationTyping undoRedo] + 296
6 Foundation 0x2f296453 -[_NSUndoStack popAndInvoke] + 250
7 Foundation 0x2f2952ef -[NSUndoManager undoNestedGroup] + 454
8 UIKit 0x3127a147 -[UIApplication alertView:clickedButtonAtIndex:] + 142
9 UIKit 0x31216449 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 144 …Run Code Online (Sandbox Code Playgroud) 我已经看过几次崩溃报告了.这是非常随机和罕见的,我无法理解.我所做的就是使用以下代码呈现模态视图控制器
ComposeController *newcontrol = [[ComposeController alloc]initWithMode:1 withNIB:@"ComposeController"];
newcontrol.delegate = self;
UINavigationController *holder = [[UINavigationController alloc] initWithRootViewController:newcontrol];
[self presentViewController:holder animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud)
不知怎的,这导致了这完全随机:
OS Version: iPhone OS 6.1 (10B143)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x9
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3b25c5d0 objc_msgSend + 16
1 CoreFoundation 0x334ba73f -[__NSPlaceholderArray initWithObjects:count:] + 271
2 CoreFoundation 0x334bae09 +[NSArray arrayWithObject:] + 45
3 UIKit 0x353e80ab -[UIWindow _rotationViewControllers] + 51
4 UIKit 0x353e7fe3 -[UIViewController viewControllerForRotation] + 91
5 UIKit …Run Code Online (Sandbox Code Playgroud) 我正在使用此代码在不同时间获取窗口的屏幕截图,并将创建的UIImage放入一个数组中,该数组传递给另一个UIViewController,以便它们可以全部显示在网格中.我尝试释放UIImage并且内存使用情况永远不会下降......我怎么能在这里使用图像,并保留所有权,这样我就可以在显示后释放内存
UIGraphicsBeginImageContext(self.window.bounds.size);
[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[imagesArray addObject:image];
[image release];