我有一个名为FHSUploadManager的NSObject,它是一个单例对象。一切似乎都在起作用,今天我一直在收到一些奇怪的消息。
2011-09-16 13:26:05.892 FHMedia[6038:6903] -[FHSUploadManager initialize]: unrecognized selector sent to instance 0x6b96900
2011-09-16 13:26:06.975 FHMedia[6038:6903] *** NSInvocation: warning: object 0xb0352cb8 of class 'úè0°8s†Gà–!Ä' does not implement methodSignatureForSelector: -- trouble ahead
2011-09-16 13:26:06.983 FHMedia[6038:6903] *** NSInvocation: warning: object 0xb0352cb8 of class 'úè0°8s†Gà–!Ä' does not implement doesNotRecognizeSelector: -- abort
看起来好像什么都坏了,但这些消息让我很担心。谁看过这个吗?任何人都知道如何调试它?
我已经采取了一些隐私和空间的方法。
这是我的FHSUploadManager.h
@class ListObject;
@class MergedItem;
@class ServerSync;
@class AppDelegate_Shared;
@class RegisteredUser;
@interface FHSUploadManager : NSObject {
NSMutableArray *uploadItems;
NSMutableArray *objectIds;
// KVO values
BOOL isSyncing;
NSString *uploadingStatus;
ListObject *uploadObject;
AppDelegate_Shared *appDelegate;
ServerSync *sync;
}
@property (assign) BOOL isSyncing;
@property (assign) NSString *uploadingStatus;
@property (assign) ListObject *uploadObject;
@property (assign) AppDelegate_Shared *appDelegate;
@end
这是FHSUploadManager.m
#import "FHSUploadManager.h"
#import "ListObject.h"
#import "Reachability.h"
#import "ServerSync.h"
#import "AppDelegate_Shared.h"
#import "ItemAttribute.h"
#import "CoreItem.h"
#import "Media.h"
#import "MergedItem.h"
#import "WebServices.h"
#import "NSManagedObject+XML.h"
#import "NSNotificationCenter+MainThread.h"
#import "PowerMeXMLParser.h"
#import "RegisteredUser.h"
#import "TBXML.h"
static FHSUploadManager* sharedInstanceFHSUploadManager = nil;
@implementation FHSUploadManager
@synthesize isSyncing;
@synthesize uploadingStatus;
@synthesize uploadObject;
@synthesize appDelegate;
- (void)dealloc {
[uploadItems release];
[uploadingStatus release];
[uploadObject release];
[objectIds release];
[sync release];
[super dealloc];
}
-(void)startUpload
{
if( !isSyncing )
{
self.isSyncing = YES;
[self performSelectorInBackground:@selector(uploadingInBackground) withObject:nil];
}
}
// !!! Other methods and not added here. !!!
#pragma mark - Apple Boiler Plate Singleton -
+ (FHSUploadManager*)sharedInstance {
@synchronized(self)
{
if (sharedInstanceFHSUploadManager == nil) {
sharedInstanceFHSUploadManager = [[super allocWithZone:NULL] init];
sharedInstanceFHSUploadManager.isSyncing = NO;
sharedInstanceFHSUploadManager.appDelegate = (AppDelegate_Shared*)[[UIApplication sharedApplication] delegate];
}
}
return sharedInstanceFHSUploadManager;
}
+ (id)allocWithZone:(NSZone *)zone {
return [[self sharedInstance] retain];
}
- (id)copyWithZone:(NSZone *)zone {
return self;
}
- (id)retain {
return self;
}
- (NSUInteger)retainCount {
return NSUIntegerMax; //denotes an object that cannot be released
}
- (void)release {
//do nothing
}
- (id)autorelease {
return self;
}
@end
更新评论后说已消失
回来了!我和一位程序员谈过,他想知道我是不是在踩着一些记忆。所以我将再研究一下。
答案 0 :(得分:0)
看起来你不是从NSObject继承......
答案 1 :(得分:0)
FHSUploadManager对象类正在取消分配。在编辑方案中启用僵尸对象。您将获得已解除分配的实例的日志。
答案 2 :(得分:-2)
释放后,您可能正在访问该对象。
在FHSUploadManager dealloc方法上添加断点。