2011-07-21 3 views
0

に到着しました:NSNotification iは、このように通知を掲示しています壊れたオブジェクト

... 
IVSession *newSession = [[[IVSession alloc] initWithDictionary:propertyDict] autorelease];  

NSDictionary *notifParams = [NSDictionary dictionaryWithObject:newSession forKey:@"session"];   
NSNotification *newSessionNotif = [NSNotification notificationWithName:IVNewSessionNotificaiton object:self userInfo:notifParams]; 
... 

IVSessionインタフェース:

@interface IVSession : IVMappableObject { 
    NSString *_ssid; 
    NSNumber *_uid;  
} 

@property (nonatomic,retain) NSString *sessionID; 
@property (nonatomic,retain) NSNumber *userID; 

し、initメソッド:

- (id)initWithDictionary:(NSDictionary*)dict 
{ 
    if ((self = [super init])) 
    { 
     NSDictionary *mapping = [self elementToPropertyMappings]; 
     for (NSString *key in mapping) 
      [self setValue:[dict objectForKey:key] forKey:[mapping objectForKey:key]]; 
    }  
    return self; 
} 

しかしこの方法では、この通知のために、私は壊れたnewSessionオブジェクトを受け取っています - そのプロパティssid d uidは無効なサマリーです:

-(void)didOpenSession:(NSNotification *)newSession 
{ 
    if (receivedSession) 
     [receivedSession release]; 
    receivedSession = [[newSession userInfo] objectForKey:@"session"]; 
} 

どこが私の過ちですか?

+0

IVNewSessionNotificaitonは間違っています – titaniumdecoy

答えて

0

コードは大丈夫です... IVSessionオブジェクトには、組み立て後、通知を送信する前に、期待どおりの内容が含まれていることが確認されていますか?

+0

実際、私はこの問題を解決しました。問題は全くありませんでした。デバッガが有効なオブジェクトに対して「無効な要約」を表示することがあります – peetonn

関連する問題