iOS 動態(tài)庫制作與調(diào)用

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,711評論 19 139
  • 轉(zhuǎn)載請注明出處:http://m.itdecent.cn/p/04a7e28f11b9作者:紀小衰 frame...
    紀小衰閱讀 6,597評論 3 16
  • 原貼地址 有沒有寫SDK或者要將一些常用的工具類做成Framework的經(jīng)歷? 你或許自己寫腳本完成了這項工作,相...
    godgnay閱讀 438評論 0 1
  • 前言 前面的兩遍文章分別介紹了制作真機上面的靜態(tài)庫和動態(tài)庫,但是問題又來了,真機上面的庫是不能在模擬器上面運行的,...
    踐行者_Leng閱讀 1,336評論 0 0
  • 戲言 正月十五元宵夜。 晚風微涼,我獨自走在街上,熙熙攘攘,恍然一驚,才察覺我已經(jīng)來到了花市。元宵節(jié)的花市仿若白晝...
    9807115ff8e3閱讀 453評論 0 0

友情鏈接更多精彩內(nèi)容