iOS에서 자주 사용하는 팁

2144 단어
 1 A.clang warning
 2 #pragma clang diagnostic push 
 3 #pragma clang diagnostic ignored "-Wgnu" 
 4 //code 
 5 #pragma clang diagnostic pop  
 6 
 7                clang     ,  AFNetworking            ,        clang     ,              ,     ?:  ,       -Wgnu     
 8 
 9 dispatch_once
10        ,      dispatch_once  ,       ,   iOS       。  :
11 static dispatch_queue_t url_request_operation_completion_queue() { 
12     static dispatch_queue_t af_url_request_operation_completion_queue; 
13     static dispatch_once_t onceToken; 
14     dispatch_once(&onceToken, ^{ 
15         af_url_request_operation_completion_queue = dispatch_queue_create("com.alamofire.networking.operation.queue",   DISPATCH_QUEUE_CONCURRENT ); 
16     }); 
17     return af_url_request_operation_completion_queue; 
18 } 
19 
20 C.weak & strong self
21       block     self,            weak      self,  block        strong      weakSelf:
22 __weak __typeof(self)weakSelf = self; 
23 self.backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ 
24     __strong __typeof(weakSelf)strongSelf = weakSelf; 
25 }]; 
26 weakSelf   block   self,      ,      strongSelf       block  ,    self          。block      strongSelf     ,        。

좋은 웹페이지 즐겨찾기