H
#import <UIKit/UIKit.h>
@interface LoginViewController : UIViewController <UITextFieldDelegate>
@property (nonatomic, retain) NSDictionary *_data;
@end
メートル
#import "LoginViewController.h"
#import "XMLReader.h"
@implementation LoginViewController
static NSDictionary *_raceInformation;
@synthesize _data, bibInput, lastNameInput, error;
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
NSError *e = [NSError alloc];
NSString *xml = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"testhalfmarathon" ofType:@"xml"] encoding:NSUTF8StringEncoding error:&e];
NSDictionary *asdf = [XMLReader dictionaryForXMLString:xml error:nil];
self._data = [XMLReader dictionaryForXMLString:xml error:nil];
//[xml release];
//[e release];
// !! BREAKPOINT HERE
}
return self;
}
Iブレークポイントをヒットした場合、self._data
ため値がnil
あるが現れます。しかし、の値のasdf
は、私がself._data
で期待する正しい辞書の値です。何がありますか?IOS NSDictionaryのは常に空
裏話:私は通常ARC
/GC
言語を使用すると、それはMRC
に来るとき、私はN00Bです。
これはずっと働いていたようですが、ちょっとした理由のために、 'self._dict'の* value *は' 'です。また、asdfが正しいデータとして表示される* self._dataを*割り当てた直後にNSDictionary * asdf = self._data;を追加することもわかりました! *奇妙な*。 –
Jacksonkr