2011-08-11 5 views
1

애널라이저는 내가 처음에 그리고 말미에 *이라는 줄이 누출되었다고 말하면서이 누설을 수정하여 경고를 없애려면 어떻게해야합니까?이 누출을 어떻게 수정합니까?

+ (void)flushOfflineQueue 
{ 
    // TODO - if an item fails, after all items are shared, it should present a summary view and allow them to see which items failed/succeeded 

    // Check for a connection 
    if (![self connected]) 
     return; 

    // Open list 
    NSMutableArray *queueList = [self getOfflineQueueList]; 

    // Run through each item in the quietly in the background 
    // TODO - Is this the best behavior? Instead, should the user confirm sending these again? Maybe only if it has been X days since they were saved? 
    //  - want to avoid a user being suprised by a post to Twitter if that happens long after they forgot they even shared it. 
    if (queueList != nil) 
    { 
     SHK *helper = [self currentHelper]; 

     if (helper.offlineQueue == nil) 
      ***helper.offlineQueue = [[NSOperationQueue alloc] init];*** 

     SHKItem *item; 
     NSString *sharerId, *uid; 

     for (NSDictionary *entry in queueList) 
     { 
      item = [SHKItem itemFromDictionary:[entry objectForKey:@"item"]]; 
      sharerId = [entry objectForKey:@"sharer"]; 
      uid = [entry objectForKey:@"uid"]; 

      if (item != nil && sharerId != nil) 
       [helper.offlineQueue addOperation:[[[SHKOfflineSharer alloc] initWithItem:item forSharer:sharerId uid:uid] autorelease]]; 
     } 

     // Remove offline queue - TODO: only do this if everything was successful? 
     [[NSFileManager defaultManager] removeItemAtPath:[self offlineQueueListPath] error:nil]; 

    } 
} 

감사!

답변

1

속성을 사용하면 종종 적절한 메모리 관리를 수행합니다. 귀하의 상황에서 당신이 설정 한 클래스를 자동으로 내 보내야합니다.

helper.offlineQueue = [[[NSOperationQueue alloc] init] autorelease]; 
+0

고마워요! 나는이 대답을 9 분 안에 받아 들일 것이다. –

관련 문제