long long mServerDurationTime = (_mExpTime.longValue) - (serverTime.longValue);
long long curTime = [[NSDate date] timeIntervalSince1970] * 1000;
NSNumber newDeviceTime = (curTime + mServerDurationTime);
我希望将newDeviceTime保存为NSNumber。
答案 0 :(得分:4)
long long mServerDurationTime = (_mExpTime.longValue) - (serverTime.longValue);
long long curTime = [[NSDate date] timeIntervalSince1970] * 1000;
NSNumber* newDeviceTime = @(curTime + mServerDurationTime);
您可以通过以下非常简单的方式将long long,int,CGFloat,...转换为NSNumber:
NSNumber* number = @(YOUR_NUMBER);
答案 1 :(得分:0)
你可以尝试
NSNumber * numberValue = [NSNumber numberWithUnsignedLongLong:(curTime + mServerDurationTime)];