Cocoa thread synchronisation when using [ALAssetsLibrary enumerateGroupsWithTypes:]

后端 未结 3 1715
别跟我提以往
别跟我提以往 2020-12-14 23:39

I have recently, like a few people, discovered that [ALAssetsLibrary enumerateGroupsWithTypes] likes to run its blocks on another thread. What a shame that Apple di

3条回答
  •  隐瞒了意图╮
    2020-12-15 00:02

    Simply use this:

    [library enumerateGroupsWithTypes:ALAssetsGroupAll 
                               usingBlock:[^(ALAssetsGroup * group, BOOL * stop)
    {
        if(group == nil)
        {
            // this is end of enumeration
        }
    }
    .
    .
    .
    

提交回复
热议问题