大佬教程收集整理的这篇文章主要介绍了ios – 在我的应用程序中找到了一个NSZombie …现在怎样?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
typedef enum { AMOwningCompanyACME,AMOwningCompanyABC,AMOwningCompanyOther } AMOwningCompany;
我需要显示一个表视图,显示此自定义对象的每个属性的值,因此对于每个枚举,我有一个看起来像这样的方法来返回字符串值:
-(NSArray*)StringsForAMOwningCompany { return [NSArray arrayWithObjects:@"ACME Co.",@"ABC Co.",@"Other",nil]; }
在我的表视图中,我遍历NsmanagedObject的属性(使用NSEntityDescription的attributesByName,对于每个属性,我调用一个调用相应“StringsFor”方法的辅助方法来返回该特定属性的字符串:
-(NSArray*)getStringsArrayForAttribute:(NSString*)attributename { SEL methodSELEctor = NSSELEctorFromString([self methodNameForAttributenamed:attributename]); NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[[AMProperty class] instanceMethodSignatureForSELEctor:methodSELEctor]]; [invocation setSELEctor:methodSELEctor]; [invocation setTarget:self.ediTingPole]; [invocation invoke]; NSArray* returnValue = nil; [invocation getReturnValue:&returnValue]; return returnValue; }
我的表视图的cellForRowATindexPath如下所示:
... NSString* itemname = self.tableData[indexPath.row]; NSAttributeDescription* desc = itemAttributes[itemname]; NSString* cellIdentifier = [self cellIdentifierForAttribute:desc]; // checks the attribute type and returns a different custom cell identifier accordingly if ([cellIdentifier isEqualToString:@"enumCell"]) { // dequeue cell,customize it UITableViewCell* enumCell = ... ... NSArray* stringvalues = [[NSArray alloc] initWithArray:[self getStringArrayForAttribute:itemname]]; int currentValue = [(NSnumber*)[self.ediTingPole valueForKey:itemname] intValue]; enumCell.detailTextLabel.text = (NSString*)stringvalues[currentValue]; return enumCell; } ...
对于其中一个属性,我一直在NSInvocation的返回数组上崩溃:
-[__NSArrayI release]: message sent to deallocated instance 0x856a4b0
使用Zombies Profiler,我看到:
我正在使用ARC.我该如何进一步调试?
以上是大佬教程为你收集整理的ios – 在我的应用程序中找到了一个NSZombie …现在怎样?全部内容,希望文章能够帮你解决ios – 在我的应用程序中找到了一个NSZombie …现在怎样?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。