iOS-Universal-Framework的页面:https://github.com/kstenerud/iOS-Universal-Framework
我通过使用此模板构建了我的框架,我已将所有类打包在模板中, 但我遇到了一个问题,我希望在我的框架中放置一些第三方框架依赖于Appdelegate,但iOS-Universal-Framework项目中没有Appdelegate类,所以我尝试添加一个“MyAppdelegate”类我的框架项目
//
// MyAppdelegate.h
// ZPFramework
//
// Created by Jin XuDong on 13-11-30.
// Copyright (c) 2013年 Jin XuDong. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyAppdelegate : UIResponder<UIApplicationDelegate>
@end
//
// MyAppdelegate.m
// ZPFramework
//
// Created by Jin XuDong on 13-11-30.
// Copyright (c) 2013年 Jin XuDong. All rights reserved.
//
#import "MyAppdelegate.h"
@implementation MyAppdelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// do somethinig depandes on appdelegate
}
@end
,然后我在我的项目中继承了MyAppdelegate,它使用了我的ZPFramework,
#import <UIKit/UIKit.h>
#import <ZPFramework/MyAppDelegate.h>
@interface AppDelegate :MyAppDelegate <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
但是..当项目运行时,它立即崩溃
2013-11-30 10:46:16.771 维派[181:60b] -[AppDelegate setWindow:]: unrecognized selector sent to instance 0x1655ebc0
2013-11-30 10:46:16.779 维派[181:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate setWindow:]: unrecognized selector sent to instance 0x1655ebc0'
*** First throw call stack:
(0x30970f4b 0x3ad006af 0x309748e7 0x30973069 0x308c24d8 0x8767b 0x331542ff 0x33153d4f 0x3314e353 0x330e941f 0x330e8721 0x3314db3d 0x3558470d 0x355842f7 0x3093b9df 0x3093b97b 0x3093a14f 0x308a4c27 0x308a4a0b 0x3314cdd9 0x33148049 0x80e09 0x3b208ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我不知道为什么,请帮助我,谢谢。