iOS SDK Development (Getting Started Guide)

What is the SDK development?

Daily development, we will encounter some cases do not provide the source code, and other project components of demand, this time we can use the SDK to develop, in the development of OC, we relate to the generally static library (.a) or dynamic library (.framework).(注:不是所有的.framework就一定是动态库)

Static library and dynamic library?

Static library: link to a complete copy of the executable file, there are multiple uses multiple redundant copies. Forms as .a和.frameworkdynamic libraries: do not copy the link, the program is run by the system dynamically loaded into memory, the program calls for the system to load only once, sharing several programs, saving memory. As a form of expression.dylib和.framework 注意:动态库只能苹果使用,如果项目中使用了动态库不允许上架(如:jspatch)

and a .framework What is the difference?

.a is a pure binary file, .framework in addition to the binary resource files outside of as well. .a file can not be used directly, at least to have .h file with, .framework files can be used directly. .a + .h + sourceFile = .framework. Recommended .framework.

The next example will help you create your own.framework

First we create a.workspace

Once created, then create a .frmawork
Will create good frmawork added to workspace
In framewrok it can be packed into their required content package
eg: I StringUtils added a test method

#import "StringUtils.h"

@implementation StringUtils
+ (NSString *)testString:(NSString *)string {
    
    return [@"MQTestFramework: " stringByAppendingString:string];
}
@end
复制代码

The next project configuration:

1, a Build Setting Build Active Architecture only parameter is set to NO

2, is provided Build Setting parameters for the Mach-O Type Static Library (configuration static, dynamic)

3, parameter setting Build Setting armv7s increase in Architectures

4, set the public needs and the need to hide the header files in the Build Phases

5, will be introduced to the header file MQTestFramwork(its own SDK header files)

6, Command + B run the project, the Product Locate framework
#### framework using the encapsulated .framework pull project requires
Use packaged function
run:

Reproduced in: https: //juejin.im/post/5cf8ad416fb9a07ee063073a

Guess you like

Origin blog.csdn.net/weixin_33941350/article/details/91429064