我们如何解决精度下降的转换问题? (Xcode 11.2)

问题描述 投票:2回答:1

自Xcode 11.2起,我收到此警告:Implicit conversion loses integer precision: 'const GULLoggerLevel' (aka 'const enum GULLoggerLevel') to 'int'

此警告使我引用此行:

dispatch_async(sGULClientQueue, ^{
    asl_log(sGULLoggerClient, NULL, level, "%s", logMsg.UTF8String);
  })

此行是此块的一部分:

     NSString *logMsg = [[NSString alloc] initWithFormat:message arguments:args_ptr];
  logMsg = [NSString stringWithFormat:@"%s - %@[%@] %@", sVersion, service, messageCode, logMsg];
  dispatch_async(sGULClientQueue, ^{
    asl_log(sGULLoggerClient, NULL, level, "%s", logMsg.UTF8String);
  });

有人可以帮我这个警告吗?

warnings precision implicit-conversion xcode11 swift5
1个回答
3
投票

您只需要用“(int)level”替换“ level”

© www.soinside.com 2019 - 2024. All rights reserved.