iosobjective-cswiftobjective-c-framework

IOS Module not found error when adding Objective-C framework projects using CocoaPods as a module in Swift project


I have scenario where i have couple of SDKs and a test app. Here is the example.

SDKCore - “Objective-C Framework”

SDKUI - “Objective-C Framework”

Code

#import "SDKUIViewController.h"
@import SDKCore;

@interface SDKUIViewController ()

@end

@implementation SDKUIViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [SDKClass hitTest];
    self.view.backgroundColor = [UIColor redColor];
}

@end

SDKTestSwift

Problem is when i compile SDKTestSwift I’m getting Module SDKCore not founda compile error on one of the files from SDKUI (See attached) enter image description here

Really got stuck here. Thanks a lot in advance.

You can download the sample project from here.


Solution

  • Sorry, I actually have misunderstood you from the start, your issue lying in your pod, not project, this happen because you didn't state that the SDKUI depend on SDKCore, thats why you cant use any code from SDKCore

    To fix this, simply add s.dependency 'SDKCore' in your SDKUI.podspec and run pod install again, then it works