作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在实用程序模板应用程序的反面 View 上显示一些数据,但应用程序在 viewDidLoad 方法结束时中止。我对 iOS 非常陌生,需要一些指导。
[super viewDidLoad];
self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
NSString *thePath = [[NSBundle mainBundle] pathForResource:@"SavedData"ofType:@"plist"];
NSMutableDictionary *tempRootDictionary;
NSMutableArray *tempMutableArray;
if (thePath && (tempRootDictionary = [NSMutableDictionary dictionaryWithContentsOfFile:thePath])) {
NSArray *keys = [tempRootDictionary allKeys];
int keysCount = [keys count];
tempMutableArray = [NSMutableArray arrayWithCapacity:keysCount];
for (int i=0; i<keysCount; i++) {
NSDictionary *dictionary = [tempRootDictionary objectForKey:[keys objectAtIndex:i]];
MyModelObject *aModelObject = [[MyModelObject alloc] init];
[aModelObject setName:[dictionary objectForKey:@"name"]];
[aModelObject setContext:[dictionary objectForKey:@"context"]];
[aModelObject setUsername:[dictionary objectForKey:@"username"]];
[aModelObject setPassword:[dictionary objectForKey:@"password"]];
[tempMutableArray addObject:aModelObject];
[aModelObject release];
[dictionary release];
}
} else {
return;
}
非常感谢您的帮助,非常感谢...
最佳答案
我在发布的代码中看到的唯一明显的问题是:
[dictionary release];
在设置字典的行上,您仅获得对 tempRootDictionary 中对象的引用,而不是它的新分配实例。所以不要释放它。删除该行。
关于iphone - FlipsideViewController 的 viewDidLoad 中的 EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4252303/
我正在基于 xcode Utility App 模板创建一个简单的实用程序应用程序。我想将 FlipsideViewController 方向限制为仅调用 FlipsideViewController
我有一个来自标准模板的 iPhone 实用程序,所以我有 MainViewController和 FlipsideViewController被初始化并调用 controller.在 controll
我试图在实用程序模板应用程序的反面 View 上显示一些数据,但应用程序在 viewDidLoad 方法结束时中止。我对 iOS 非常陌生,需要一些指导。 [super viewDidLoad]; s
我写了一个简单的例子,我有一个实用程序项目,上面有一个 UIScrollView。当我单击信息按钮翻转屏幕并返回时,UIScrollView 现在没有响应。不仅如此,我还特意将滚动条放在左上角的 In
我是一名优秀的程序员,十分优秀!