iOS制作SDK并上傳到cocopods上

1、制作SDK

創(chuàng)建工程選Framework

1.png

2拇派、設(shè)置工程的Build Settings的Build Active Architecture Only為NO

2.png

3荷辕、設(shè)置run為release

3.png

4、設(shè)置最低版本號(hào)與機(jī)型

4.png

5件豌、設(shè)置Mach-O Type為Static Library(靜態(tài)庫(kù))

5.png

6疮方、模擬器真機(jī)合并是會(huì)報(bào)錯(cuò),模擬器里也包含arm64茧彤,需要排除一下骡显,Build Settings ->Architectures ->Excluded Architectures -> Release -> Any iOS Simulator SDK -> arm64


7、模擬器真機(jī)各運(yùn)行一遍曾掂,Products會(huì)生成對(duì)應(yīng)的庫(kù)惫谤,右擊 -> Show in Finder 可以看到生成的對(duì)應(yīng)庫(kù),查看庫(kù)支持的機(jī)型可用命令:lipo -info framework路徑

8珠洗、合并真機(jī)模擬器:lipo -create 真機(jī)路徑 模擬器路徑 -output 真機(jī)路徑

9溜歪、本地集成的時(shí)候如果是M1芯片模擬器運(yùn)行會(huì)報(bào)錯(cuò):building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

解決方案:源工程和pod工程去掉arm64



10、bundle的生成:桌面上新建文件夾修改后綴為.bundle然后把圖片放進(jìn)去

11许蓖、上傳到git上

創(chuàng)建一個(gè)SDK文件夾蝴猪,把剛剛生成的framwork和bundle放入文件夾中,再上傳到git

6.png

12膊爪、上傳到cocopods上

先給剛剛上傳git的SDK打個(gè)tag值自阱,cd到SDK目錄下:

git tag 1.0.0

git push --tags

這個(gè)tag要和之后創(chuàng)建的podspec版本要一直,以后升級(jí)SDK后都要修改

13米酬、創(chuàng)建podspec

cd到SDK目錄下:pod spec create FrameworkTest

spec示例:

#

#? Be sure to run `pod spec lint GameFrameworkTool.podspec' to ensure this is a

#? valid spec and to remove all comments including this before submitting the spec.

#

#? To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html

#? To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/

#

Pod::Spec.new do |spec|

? # ―――? Spec Metadata? ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? These will help people to find your library, and whilst it

? #? can feel like a chore to fill in it's definitely to your advantage. The

? #? summary should be tweet-length, and the description more in depth.

? #

? spec.name? ? ? ? = "GameFrameworkTool"

? spec.version? ? ? = "1.1.7"

? spec.summary? ? ? = "GameSDK Tool"

? # This description is used to generate tags and improve search results.

? #? * Think: What does it do? Why did you write it? What is the focus?

? #? * Try to keep it short, snappy and to the point.

? #? * Write the description between the DESC delimiters below.

? #? * Finally, don't worry about the indent, CocoaPods strips it!

? spec.description? = <<-DESC

? 工具類

? ? ? ? ? ? ? ? ? DESC

? spec.homepage? ? = "https://github.com/shuaiChenging/Game-SDK.git"

? # spec.screenshots? = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"

? # ―――? Spec License? ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? Licensing your code is important. See https://choosealicense.com for more info.

? #? CocoaPods will detect a license file if there is a named LICENSE*

? #? Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.

? #

? # spec.license? ? ? = "MIT (example)"

? spec.license? ? ? = { :type => "MIT", :file => "LICENSE" }

? # ――― Author Metadata? ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? Specify the authors of the library, with email addresses. Email addresses

? #? of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also

? #? accepts just a name if you'd rather not provide an email address.

? #

? #? Specify a social_media_url where others can refer to, for example a twitter

? #? profile URL.

? #

? spec.author? ? ? ? ? ? = { "111" => "1111" }

? # Or just: spec.author? ? = "111"

? # spec.authors? ? ? ? ? ? = { "111" => "1111" }

? # spec.social_media_url? = "https://twitter.com/1111"

? # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? If this Pod runs only on iOS or OS X, then specify the platform and

? #? the deployment target. You can optionally include the target after the platform.

? #

? spec.platform? ? = :ios

? spec.ios.deployment_target = "12.0"

? # spec.platform? ? = :ios, "12.0"

? #? When using multiple platforms

? # spec.ios.deployment_target = "5.0"

? # spec.osx.deployment_target = "10.7"

? # spec.watchos.deployment_target = "2.0"

? # spec.tvos.deployment_target = "9.0"

? # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? Specify the location from where the source should be retrieved.

? #? Supports git, hg, bzr, svn and HTTP.

? #

? spec.source? ? ? = { :git => "https://github.com/shuaiChenging/Game-SDK.git", :tag => "#{spec.version}" }

? # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? CocoaPods is smart about how it includes source code. For source files

? #? giving a folder will include any swift, h, m, mm, c & cpp files.

? #? For header files it will include any header in the folder.

? #? Not including the public_header_files will make all headers public.

? #

? #spec.source_files? = "Classes", "Classes/**/*.{h,m}"

? #spec.exclude_files = "Classes/Exclude"

? # spec.public_header_files = "Classes/**/*.h"

? # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? A list of resources included with the Pod. These are copied into the

? #? target bundle with a build phase script. Anything else will be cleaned.

? #? You can preserve files from being cleaned, please don't preserve

? #? non-essential files like tests, examples and documentation.

? #

? spec.resource? = "Framework/Bundle.bundle"

? spec.ios.vendored_frameworks = "Framework/GameSDK.framework"

? # spec.resources = "Resources/*.png"

? # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"

? # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? Link your library with frameworks, or libraries. Libraries do not include

? #? the lib prefix of their name.

? #

? spec.framework? = "UIKit","Foundation"

? # spec.frameworks = "SomeFramework", "AnotherFramework"

? # spec.library? = "iconv"

? # spec.libraries = "iconv", "xml2"

? # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

? #

? #? If your library depends on compiler flags you can set them in the xcconfig hash

? #? where they will only apply to your library. If you depend on other Podspecs

? #? you can include multiple dependencies to ensure it works.

? # spec.requires_arc = true

? # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }

? spec.dependency 'Masonry','1.1.0'

? spec.dependency 'JKCategories', '1.9.3'

? spec.dependency 'IQKeyboardManager', '6.5.8'

? spec.dependency 'AFNetworking', '4.0.1'

? spec.dependency 'MJExtension', '3.3.0'

? spec.dependency 'MBProgressHUD', '1.2.0'

end

14沛豌、發(fā)布到cocopods

pod trunk push ./FrameworkTest.podspec?--skip-import-validation --allow-warnings

發(fā)布成功之后大概過(guò)個(gè)十分鐘就可以安裝了:pod ‘FrameworkTest’

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市赃额,隨后出現(xiàn)的幾起案子琼懊,更是在濱河造成了極大的恐慌,老刑警劉巖爬早,帶你破解...
    沈念sama閱讀 218,525評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件哼丈,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡筛严,警方通過(guò)查閱死者的電腦和手機(jī)醉旦,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,203評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人车胡,你說(shuō)我怎么就攤上這事檬输。” “怎么了匈棘?”我有些...
    開(kāi)封第一講書人閱讀 164,862評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵丧慈,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我主卫,道長(zhǎng)逃默,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書人閱讀 58,728評(píng)論 1 294
  • 正文 為了忘掉前任簇搅,我火速辦了婚禮完域,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘瘩将。我一直安慰自己吟税,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,743評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布姿现。 她就那樣靜靜地躺著肠仪,像睡著了一般。 火紅的嫁衣襯著肌膚如雪备典。 梳的紋絲不亂的頭發(fā)上藤韵,一...
    開(kāi)封第一講書人閱讀 51,590評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音熊经,去河邊找鬼。 笑死欲险,一個(gè)胖子當(dāng)著我的面吹牛镐依,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播天试,決...
    沈念sama閱讀 40,330評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼槐壳,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了喜每?” 一聲冷哼從身側(cè)響起务唐,我...
    開(kāi)封第一講書人閱讀 39,244評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎带兜,沒(méi)想到半個(gè)月后枫笛,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,693評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡刚照,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,885評(píng)論 3 336
  • 正文 我和宋清朗相戀三年刑巧,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,001評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡啊楚,死狀恐怖吠冤,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情恭理,我是刑警寧澤拯辙,帶...
    沈念sama閱讀 35,723評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站颜价,受9級(jí)特大地震影響涯保,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜拍嵌,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,343評(píng)論 3 330
  • 文/蒙蒙 一遭赂、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧横辆,春花似錦撇他、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書人閱讀 31,919評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至脆侮,卻和暖如春锌畸,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背靖避。 一陣腳步聲響...
    開(kāi)封第一講書人閱讀 33,042評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工潭枣, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人幻捏。 一個(gè)月前我還...
    沈念sama閱讀 48,191評(píng)論 3 370
  • 正文 我出身青樓盆犁,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親篡九。 傳聞我的和親對(duì)象是個(gè)殘疾皇子谐岁,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,955評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容