IOS uses XCODE8 to make dynamic libraries and static libraries

Source: Internet
Author: User

When using a third-party SDK, you often encounter only one dynamic or static library that they provide and cannot get the source code. Using the dynamic library FrameWork or the static library Lib, you can satisfy the need not to show the specific implementation of the core code to the user, but also to avoid other people to change the code incorrectly.

First, the production of dynamic library FrameWork:

Open Xcode and select the Cocoa Touch FrameWork.

  

Create a new Publicmodel file, simple output log

  

If this Publicmanager file wants to expose the header file externally. Need

  

Then compile and get the dynamic library FrameWork

  

So far, a simple FrameWork has been created. The next step is to use the FrameWork.

Drag the FrameWork into the works. Introduction of #import <DynamicFrameWorkMake/PublicManager.h>

Publicmanager *manager = [[Publicmanager alloc] init];[ Manager Printlog:@ " This is a printed message "];

Compile run, you will find the introduction of the header file there is a warning "Missing submodule ' Dynamicframework.publicmanager '", the console will error:

  

You need to add the created FrameWork to the general Embedded Binaries.

  

The way to resolve the "Missing submodule ' Dynamicframework.publicmanager" warning is to add the "#import in the DynamicFrameWorkMake.h file when compiling the dynamic library. <DynamicFrameWorkMake/PublicManager.h>"

  

It is important to note that the build FrameWork is related to our chosen compilation environment, if you choose to compile the simulator, the import will be in the real machine run error, but also the Debug and Release mode points.

The following can be compiled from the FrameWork and simulator compiled by the real machine to merge.

  

Open Terminal, enter:

Lipo-create + Emulator directory + Real machine directory-output merged directory.

Eg: lipo-create/users/robin/library/developer/xcode/deriveddata/ Dynamicframeworkmake-fafcaqoabyywoqfahbpuzhfcltmd/build/products/debug-iphoneos/dynamicframeworkmake.framework /dynamicframeworkmake/users/robin/library/developer/xcode/deriveddata/ dynamicframeworkmake-fafcaqoabyywoqfahbpuzhfcltmd/build/products/debug-iphonesimulator/ Dynamicframeworkmake.framework/dynamicframeworkmake-output/users/robin/desktop/dynamicframework

If error:error:/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/lipo:can ' t move temporary file:/users/robin/desktop/dynamicframework to File:/users/zhangtibin/desktop/ Dynamicframework.lipo (is a directory)

  

  

IOS uses XCODE8 to make dynamic libraries and static libraries

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.