1.創(chuàng)建動態(tài)庫
2.新建一個類 Person
#import@interface Person : NSObject
-(void)run;
@end
#import "Person.h"#import@implementation Person
-(void)run{
NSLog(@"let's run.");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"動態(tài)庫調(diào)用成功了.." message:@"????" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"done", nil];
[alert show];
}
@end
頭文件設置為Public
3.添加Target Aggregate 插入shell腳本保證可以在真機和模擬器可以使用
# Sets the target folders and the final framework product.
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework
# Working dir will be deleted after the framework creation.
WRK_DIR=build
DEVICE_DIR=${WRK_DIR}/Release-iphoneos/$? ? {FMK_NAME}.framework
SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework
# -configuration ${CONFIGURATION}
# Clean and Building both architectures.
# 分別編譯生成真機和模擬器使用的framework
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos clean build
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator clean build
# Cleaning the oldest.
if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi
mkdir -p "${INSTALL_DIR}"
cp -R "${DEVICE_DIR}/" "${INSTALL_DIR}/"
# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
# 使用lipo命令將其合并成一個通用framework
# 最后將生成的通用framework放置在工程根目錄下新建的Products目錄下
lipo -create "${DEVICE_DIR}/${FMK_NAME}" "${SIMULATOR_DIR}/${FMK_NAME}" -output "${INSTALL_DIR}/${FMK_NAME}"
rm -r "${WRK_DIR}"
run后就show finder 找到就可以用了
測試導入FrameWork 導入頭文件 調(diào)用成功OK