clang静态分析警告:Object autorelease too many times

来源:互联网 发布:淘宝刷手退款能报警吗 编辑:程序博客网 时间:2024/05/20 18:01

clang静态分析警告:Object autorelease too many times

红框中的init方法大小写

问题代码块

MusicFeeAuthQueryingPopView *queryView = [[MusicFeeAuthQueryingPopView alloc] initwithMusicId:mediaItem.persistentId authType:KWMFAuthorityPlay resourceType:KWMFResourceTypeAudio];    [queryView show:nil sipState:NO];    [queryView doModal];    [queryView autorelease];    if (queryView.resultUserCancel )        return NO;    if ([queryView resultAuthCheckSuccessWithOperation:causeType])        return YES;    KWMusicFeeOneItem * feeOneItem = [queryView resultFirstFeeSong:causeType];

当把MusicFeeAuthQueryingPopView的initwithMusicId改称initWithMusicId ,即符合initWith的命名格式,再次用clang分析,告警消失.

如果打开clang的详细分析结果,会发现小写的initwithMusicId返回的是引用计数0的对象(clang的分析错误,不是运行时结果)
a+0

0 0
原创粉丝点击