错误在64位中迁移unsigned char *

时间:2015-09-01 07:17:15

标签: ios objective-c nsdata

假设我使用32位保存此NSData,但现在我的用户正在迁移并使用64位。

当我从我的文件中取回NSData并再次读取时,它读错了,因为字节不同。任何帮助将不胜感激:

-(IBAction) generate{   
    NSData *data = [[File sharedFile] getObject:@"token"];
    unsigned char *ch = (unsigned char*)[data bytes]; // I think this is went wrong, when the bytes now is different. 
    Token *d;
    d = d->resurrect(ch); // this read differently if the unsigned char is different size
    NSString* token = [NSString stringWithFormat:@"%s",d->generateToken()]; 
}


更新

resurrect()是静态库方法,

static Device* resurrect(unsigned char* bdev); 

0 个答案:

没有答案