2013-01-10 63 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"]; 
}