search

Home  >  Q&A  >  body text

objective-c - 真机测试NSProgress不打印进度

progress:^(NSProgress * _Nonnull uploadProgress) {
NSLog(@"进度 - %f", uploadProgress.fractionCompleted);
}

真机测试的时候,这个日志不能打印,模拟器上是好使的,这个block里打断点也不会停,why?

黄舟黄舟2757 days ago597

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:30:09

    A common reason for this situation is redefining NSLog.
    Please check if there is code similar to the one below in your project.

    #ifdef DEBUG
    #define NSLog(format, ...) do {                                                                          \
    fprintf(stderr, "<%s : %d> %s\n",                                           \
    [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],  \
    __LINE__, __func__);                                                        \
    (NSLog)( (format), ## __VA_ARGS__ );                                           \
    fprintf(stderr, "-------\n");                                               \
    } while (0)
    #else
    #   define NSLog(...)
    #endif
    

    reply
    0
  • Cancelreply