2013-01-10 62 views
1

我使用班车磁带读取,我将响应[notification object]到的NSData然后将其转换为NSString的转换NSData的

NSData* data = [notification object]; 
NSString* response = [[NSString alloc] initWithData: data encoding:NSASCIIStringEncoding]; 

但是,当我尝试NSLog(@"RESPONSE: %@", response);

输出仅仅是一个倒?关于如何正确处理Shuttle MagStripe读卡器的刷卡响应的任何想法?

+1

哪里是它发出的数据规格的对象?没关系,你必须购买该套件才能看到......可能没有多少人能够帮助你,因为我们不知道数据应该是什么。 – borrrden

回答

1

尝试这种方式,传递信息

NSDictionary *userInfo = [NSDictionary dictionaryWithObject:<#yourNSDataObject> forKey:@"pass"]; 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"myevent" object:nil userInfo:userInfo]; 

,并在接收器上methord得到像

- (void)receiveEvent:(NSNotification *)notification { 
    NSData pass = [[notification userInfo] valueForKey:@"pass"]; 
}