在一个项目中使用2个不同的框架版本

时间:2016-10-31 16:13:31

标签: ios xcode nest-api

甚至可以在我的XCode项目中使用同一框架的两个版本吗?

我需要Firebase.framework pre google版本(连接到NEST API)以及新版本(现在用于分析)。 我尝试创建一个使用旧LegacyFirebase.Framework文件编译的中间Firebase.framework

#import "LegacyFirebase.h"
#import <Firebase/Firebase.h>

@interface LegacyFirebase () {
@private
    Firebase * fb;
}
@end

@implementation LegacyFirebase

-(instancetype)init:(NSString *) urlString  {
    self = [super init];
    if(self){
        fb = [[Firebase alloc] initWithUrl:urlString];
    }

    return self;
}

- (void)authorize:(NSString *) token completion: (void (^)(NSError *error , id data))block {
    [fb authWithCredential:token withCompletionBlock:^(NSError *error, id data) {
        block(error, data);
    } withCancelBlock:^(NSError *error) {
        block(error, nil);
    }];
}

-(void)subscribe: (void (^)(NSDictionary* data))block {
    [fb observeSingleEventOfType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {
        block(snapshot.value);
    }];
}

但是当我将它添加到已包含新Firebase.framework的项目中时 - LegacyFirebase似乎使用了新的。

EDIT / DONE:

管理以创建正确的中间LegacyFirebase.Framework。我可以在我的项目中使用它并且没有冲突。

0 个答案:

没有答案