2014-06-20 1 views
0

을 모니터하기 위해 블록을 사용하여 : 나는 개체를 캐시에 추가 할 때 메시지를 인쇄하려면이 활용하기 위해 노력하고있어TMCache - 캐시 이벤트 문서에서

/** 
A block to be executed just after an object is added to the cache. This block will be excuted within 
a barrier, i.e. all reads and writes are suspended for the duration of the block. 
*/ 
@property (copy) TMMemoryCacheObjectBlock didAddObjectBlock; 

. 지금까지 시도 :

[[_timedCache memoryCache] setDidAddObjectBlock:^{ 
    NSLog(@"added something to cache"); 
}]; 

그러나 이것은 "매개 변수 형식 불일치"컴파일러 오류를 제공합니다. 나는 Objective-C에 상당히 익숙하며 아마 여기 뭔가 순진한 행동을하고있을 것이다. 어떤 제안?

답변

1

TMemoryCahceObjectBlock에는 다음과 같은 서명이 있습니다. 블록에없는 서명은 (TMMemoryCache *cache, NSString *key, id object)입니다. 블록의 서명을 변경하면 금색입니다.