English 中文(简体)
iPad 中调用器当前不拥有的对象的引用计数减少不正确
原标题:Incorrect decrement of the reference count of an object that is not owned at this point by the caller in iPad
-(id)init
{
if (self = [super init]) 
{
    self.dmrPlaylists = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];
     }
}
-(void)dealloc
{   
[self.dmrPlaylists release];
}
-(DMRPlaylist *)getDMRPlaylistByUUID:(NSString *)deviceUUID
{
if (deviceUUID == nil)
    return nil;

for(int i = 0; i < self.dmrPlaylists.count; i++)
{
    DMRPlaylist * dmrPlaylist = [self.dmrPlaylists objectAtIndex:i];
    if([dmrPlaylist.deviceUUID isEqualToString:deviceUUID])
    {
        return dmrPlaylist;
    }
}

return nil;
}

内存( Core Found/ Object- C) 调用器当前不拥有的对象的引用计数减少错误 。

提前感谢。

最佳回答

(1) 在您的 init dealloc 方法中,不要使用 self.dmrPlaylists 。 相反,要与基本变量互动。

(2) 调用[超级经销

不知道警示是开哪条线, 无法肯定, 但这些都是问题。

问题回答

您没有告诉我们上述代码的哪个部分导致错误。 请与调试器一起通过它, 以孤立发生错误的地方, 并返回到我们那里 。

而且,你没有给我们足够的代码 来知道什么是错的。例如:

self.dmrPlaylists = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];

可能最终会调用 -setDmPlaylists: 和自动释放变异阵列。 -setDrPlaylists: 定义在哪里? 它是否由 -property 声明和 宣布? 如果是的话, 它是否被宣布为 retain 属性? 如果不是, 设置人就不会在变异阵列中调用 < codecode> retain 。 当 < code> 在事件循环结束时将变异阵保留计数时, 它可能会被标记为“ 垃圾存储” 。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签