IOS framework cannot be updated after initial archiving

I am creating an iOS framework for use in another application. I roughly followed this tutorial to get up and go.

At first everything worked. I archived a project that was as simple as:

Eh

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

FOUNDATION_EXPORT double EVersionNumber;
FOUNDATION_EXPORT const unsigned char EVersionString[];

@interface E : NSObject

+ (void)showAlert;

@end

      

Em

#import "E.h"

@implementation E

+ (void)showAlert {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello There!"
                                                    message:@""
                                                   delegate:nil
                                          cancelButtonTitle:@"Cool"
                                          otherButtonTitles:nil];
    [alert show];
}    

@end

      

I have included archived output of the Debug and Release directories in my application and added a link to the file .framework

via the Embedded Binary section of the application build settings.

I started my app with this basic bit:

ViewController.m

#import "ViewController.h"
#import "E.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [E showAlert];
}

@end

      

Everything works great here.

However, the weirdness started when I tried to add a method to the framework code. I updated all versions, cleaned up, zipped the new framework version, erased all old infrastructure information from the application where it was included, and then added the new framework version to the application.

Here are the updated framework files:

Eh

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

FOUNDATION_EXPORT double EVersionNumber;
FOUNDATION_EXPORT const unsigned char EVersionString[];

@interface E : NSObject

+ (void)showAlert;
+ (void)showNewAlert;

@end

      

Em

#import "E.h"

@implementation E

+ (void)showAlert {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello There!"
                                                    message:@""
                                                   delegate:nil
                                          cancelButtonTitle:@"Cool"
                                          otherButtonTitles:nil];
    [alert show];
}    

+ (void)showNewAlert {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New Method!"
                                                    message:@"Does this work??"
                                                   delegate:nil
                                          cancelButtonTitle:@"Cool"
                                          otherButtonTitles:nil];
    [alert show];
}

@end

      

I launched my application with this new code:

ViewController.m

#import "ViewController.h"
#import "E.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [E showNewAlert];
}

@end

      

The app runs successfully, but I get this on startup:

+[E showNewAlert]: unrecognized selector sent to class 0x10ef57188

      

+3


source to share


1 answer


Why is E a subclass of NSObject and not a subclass of UIViewController?



0


source







All Articles