iOS知识备忘

2019-01-02  本文已影响9人  LeverTsui
// completionBlock在AFURLConnectionOperation中被手动的设置为nil来打破保留周期。
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
    self.completionBlock = ^ {
        ...
    };
#pragma clang diagnostic pop
#ifdef __IPHONE_8_0
  NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];//根据Identifer获取公历
#else
  calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];//根据Identifer获取公历
#endif
  calendar.timeZone = [NSTimeZone localTimeZone];//消除时区差异
  calendar.locale = [NSLocale currentLocale];//消除本地化差异,本地化包括语言、表示的日期格式等 
  NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
  formatter.calendar = calendar; 
static pthread_mutex_t _sharedDebugLock;
pthread_mutex_lock(&_sharedDebugLock);
...
pthread_mutex_unlock(&_sharedDebugLock);
dispatch_semaphore_t  framesLock = dispatch_semaphore_create(1);
dispatch_semaphore_wait(framesLock, DISPATCH_TIME_FOREVER);
...
dispatch_semaphore_signal(framesLock);
__weak typeof(self) weakSelf = self;
 self.testObject.testCircleBlock = ^{
      __strong typeof (weakSelf) strongSelf = weakSelf;
      [strongSelf doSomething];
}; 
上一篇 下一篇

猜你喜欢

热点阅读