0

I create my own framework.

I have a class A which will be export to public usage In file A.m, I just add some simple lines of code

@interface A ()
{
    CTCallCenter* mCallCenter;
}
@end

@implementation A

- (instancetype)init {
    if (self = [super init]) {
        mCallCenter = [[CTCallCenter alloc] init];
    }
    return self;
}

- (void)dealloc {
    [super dealloc];
}

@end

I added framework CoreTelephony in my .pch file

#import <CoreTelephony/CTCallCenter.h>

My framework is built successfully as guide from site http://www.raywenderlich.com/65964/create-a-framework-for-ios

I check my framework fat file, it includes 4 slices:

Architectures in the fat file: <MyFramework> are: armv7 i386 x86_64 arm64 

But when I include my framework to project test and use class A. It gets build error like

**Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CTCallCenter", referenced from:
      objc-class-ref in MyFramework(A.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)**

In file ViewController.m in project test

#import "ViewController.h"
#import <MyFramework/A.h>

@interface ViewController ()

@end

@implementation ViewController

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

    A* ATest = [[A alloc] init];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

This is a screenshot of my framework Build Settings

enter image description here

Can anyone help me figure out what I miss

Scofield Tran
  • 828
  • 1
  • 18
  • 30
  • r u checked in device or simulator – Anbu.Karthik Feb 05 '15 at 08:41
  • @Anbu.Karthik, the project test is built error both in device or simulator – Scofield Tran Feb 05 '15 at 08:42
  • Is `CTCallCenter` in a framework or static library ? It seems that the framework or static library is not supported to arm64. – KudoCC Feb 05 '15 at 08:43
  • may be the [link1](http://stackoverflow.com/questions/19213782/undefined-symbols-for-architecture-arm64) helps you – Anbu.Karthik Feb 05 '15 at 08:45
  • @KudoCC, the class CTCallCenter is in framework CoreTelephony of iOS, I don't know does it support arm64 or not, is there anyway to use it – Scofield Tran Feb 05 '15 at 08:45
  • Hmm... It should support. Do you add the `CoreTelephony` framework to the build phases->Link Binary with Libraries (note that the project is which uses your framework) ? – KudoCC Feb 05 '15 at 08:50
  • @KudoCC, I added on MyFramework project, but on project test I didn't add CoreTelephony framework. I suppose MyFramework must wrapper all, if I add a ton of framework on MyFramework project and then re-add again on the project which use MyFramework, my framework will lose its value – Scofield Tran Feb 05 '15 at 08:58
  • Adding it in your framework won't wrapper it, your framework only contains some hints that tell the linker it needs the symbol `CTCallCenter`. Try to add to the project which use MyFramework. – KudoCC Feb 05 '15 at 09:02
  • did you found any solutions... – Mahesh Agrawal Aug 23 '15 at 11:35
  • I would also like to know if there's an answer to this question. This issue is maybe same thing I asked in here: http://stackoverflow.com/questions/33803461/ios-framework-dependency-on-third-party-ios-framework – uerceg Nov 20 '15 at 09:14
  • how did you solve this? Please help me out. Same thing is happening with me now. – Arun Kumar Aug 16 '17 at 07:17

0 Answers0