1

I have an NSObject called FHSUploadManager, which is a singleton object. Everything has appears to be working, expect today I been getting some strange messages.

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

It does not look like anything is broken, but these messages have me concern. Has anyone seen this before? Anyone have an idea on how to debug this?

I have taken out some of the methods for privacy and space.

Here is my 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

Here is 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

Update After comment saying it was gone

It is back! I talked with a fellow programmer and he is wondering if I am stomping on some memory. So I am going to look into a little bit more.

NixonsBack
  • 390
  • 2
  • 15
  • 1
    have you tried to delete the derived data and re-index, clean and recompile again? Are you sure that nothing - like unwanted file corruption - happened? You may also try to copy the complete project files and try again... – user387184 Sep 16 '11 at 19:40
  • The first error you are showing is from the initialize method, which isn't present in the code you posted. – Danra Sep 16 '11 at 20:01
  • The initialize method is a method of the NSObject. It is called right when the class is first created. http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/clm/NSObject/initialize – NixonsBack Sep 16 '11 at 20:05
  • Most probably a file is corrupted. These errors happen when you don't inherit from NSObject "Which isn't your case". But the weird thing is the class name "úè0°8s†Gà–!Ä". I suggest you clean everything up and re-create the files – Sami Sep 16 '11 at 20:08
  • Stranger and Stranger. After having this problem all day, I step away and come back and I don't have the problem anymore. If I get this problem again I will check to see if the file is corrupted and or if a good xcode clean will fix it. How do I mark this for stackoverflow? – NixonsBack Sep 16 '11 at 20:19
  • again, just to make sure I really would delete the derived data and copy all project files - otherwise this may haunt you. Also possibly the HD has a problem and one file just got corrupted - check the HD - otherwise you may get a weird error some other day... – user387184 Sep 16 '11 at 22:08
  • It might be possible that the problem might be in some other header files. which you are adding. By the way try to avoid "@class" declarations and add the header file. It helps you in catching more problems at compile time. – Master Yoda Sep 16 '11 at 22:43
  • user387184: Deleting the files, doing a clean and re-indexing does not solve the problem. Still looking into it, just don't have time to really focus on it. – NixonsBack Sep 28 '11 at 22:19
  • Possible duplicate of [How can I debug 'unrecognized selector sent to instance' error](https://stackoverflow.com/questions/25853947/how-can-i-debug-unrecognized-selector-sent-to-instance-error) – Cœur Jul 08 '19 at 05:52

3 Answers3

0

The FHSUploadManager object class is deallocating. In the Edit Schemes Enable Zombie Objects. You will get log of the deallocated instance.

RashDash
  • 3
  • 4
0

Looks like you are not inheriting from NSObject...

Macmade
  • 52,708
  • 13
  • 106
  • 123
-2

You may be accessing the object once it is freed.

Add a breakpoint on FHSUploadManager dealloc method.

seppo0010
  • 15,184
  • 5
  • 31
  • 30