简体   繁体   English

在Xcode 8中将框架项目包含到我的项目中

[英]Include framework project into my project in Xcode 8

I have trouble compiling My app (Xcode app project) when my framework (Xcode framework project) is linked and files are added to the framework (not used in the app). 当链接我的框架(Xcode框架项目)并将文件添加到框架(未在应用程序中使用)时,编译我的应用程序(Xcode应用程序项目)时遇到麻烦。

What I did: 我做了什么:

  1. Create folder MyProject 创建文件夹MyProject
  2. Create Xcode single view project (MyApp project) -> output of this is a folder MyApp inside MyProject folder containing all the data 创建Xcode单视图项目(MyApp项目)->输出为MyProject文件夹内的My​​App文件夹,其中包含所有数据
  3. Create Xcode framework project (MyFramework project) -> output of this is a folder MyFramework inside MyProject folder containing all the data 创建Xcode框架项目(MyFramework项目)->输出结果是MyProject文件夹内的My​​Framework文件夹,其中包含所有数据
  4. Create workspace and import both projects into the workspace -> output of this is file .xcworkspace in the folder MyProject 创建工作区并将两个项目都导入到工作区中->输出为MyProject文件夹中的文件.xcworkspace

So, after this I have hierarchy: 因此,在此之后,我有了层次结构:

->MyProject - > MyProject的

--->MyApp ---> MyApp的

--->MyFramework ---> MyFramework

--->MyWorkspace.xcworkspace ---> MyWorkspace.xcworkspace

Then in General tab of MyApp project I've added in Embedded Binaries my framework. 然后,在MyApp项目的“常规”选项卡中,将我的框架添加到“嵌入式二进制文件”中。 This linked my framework with my app and when I compiled it my app started fine on the phone. 这将我的框架与我的应用程序链接在一起,当我对其进行编译时,我的应用程序在手机上开始正常运行。

After that I've added one Objective-C .h/.m pair of classes to the framework, added them to the framework target (compiled sources has .m file, header file is selected as public). 之后,我在框架中添加了一对Objective-C .h / .m类,并将它们添加到框架目标中(编译源具有.m文件,头文件被选择为公共)。

When I try to compile and run the app one more time on the device, I get the error: 当我尝试在设备上再编译并运行一次应用程序时,出现错误消息:

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

Go to your Project's Target -> Build Settings, then: 转到项目的目标->构建设置,然后:

Try Setting your Architectures Setting to: $(ARCHS_STANDARD) 尝试将架构设置设置为: $(ARCHS_STANDARD)

And set "Build Active Architecture" to No 并将“ Build Active Architecture”设置为 否”

Hope this Helps :-) 希望这可以帮助 :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM