开发者

how to get rid of warning related to : indexForInsertingObject:sortedUsingBlock:

开发者 https://www.devze.com 2023-03-14 09:53 出处:网络
I have the following line of code: int insertIdx = (int)[self.itemsToDisplay indexFor开发者_高级运维InsertingObject:item sortedUsingBlock:^(id a, id b) {

I have the following line of code:

 int insertIdx = (int)[self.itemsToDisplay indexFor开发者_高级运维InsertingObject:item sortedUsingBlock:^(id a, id b) {
        MWFeedItem *item1 = (MWFeedItem *) a;
        MWFeedItem *item2 = (MWFeedItem *) b;
        return [item1.date compare:item2.date];
    }];

but XCode gives me the following warning on it:

NSMutableArray' may not respond to '-indexForInsertingObject:sortedUsingBlock:

how to get rid of this warning ? and could I know where excatly this method is defined in the SDK ? thanks so much in advance ...


-indexForInsertingObject:sortedUsingBlock: is not part of the official, public SDK. Since it looks like you haven’t declared and implemented a category on NSMutableArray that contains that method, you could write one based on this blog post by Jayway Team. Having done that, it’s just a matter of importing the header file that declares the category.


to disable the warnings for one file add this:

#pragma GCC diagnostic ignored "-Wwarning-flag"

It should ignore all warnings. The problem is however you will not see any warnings in that file. even if they are legit.

0

精彩评论

暂无评论...
验证码 换一张
取 消