Cocoapods에 iOS LIBRARY 배포

Cocoapods에 iOS LIBRARY 배포

arammoon
Veritas Liberabit Vos, Tech Blog

YoutubePlayerHelper Library를 작성해서 Cocoapods로 배포를 해보자


Step1: Library 작성

1. 프로젝트 생성

$ pod lib create [project Name]
ex) $ pod lib create YoutubePlayerHelper

2. 라이브러리 작성


Step2: Github에 소스 작성

Step3: cocoa pod에 올리기

Step4: 다운로드 받아서 잘 동작 하는지 확인 해 보기

local project 실행

use_frameworks!
target 'YoutubePlayerSample' do
  pod 'YoutubePlayerHelper', path => '/'
end

pod project

use_frameworks!
target 'YoutubePlayerSample' do
  pod 'YoutubePlayerHelper'
end

1. project 생성

YoutubeplayerSample 생성

2. pod setting

  • pod 파일 생성

    $ pod init

  • pod 파일 편집

    pod ‘YoutubePlayerHelper’

  • pod 설치

    $ pod install

Warn 2개(summary And Version)

Mac:YoutubePlayerHelper aram$ pod trunk push YoutubePlayerHelper.podspec
Updating spec repo `trunk`
Validating podspec
 -> YoutubePlayerHelper (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | [iOS] swift: The validator used Swift `4.0` by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_versions` attribute in your podspec. Note that usage of a `.swift-version` file is now deprecated.
  1. summary 수정
  2. Swift version 5.0으로 수정
  3. Xcode Target Version 변경 SWIFT_VERSION = 5.0
  4. .podspec 버전 정보 추가

    s.swift_version    = '5.0'

Success

Mac:YoutubePlayerHelper aram$ pod trunk push YoutubePlayerHelper.podspec
Updating spec repo `trunk`
Validating podspec
 -> YoutubePlayerHelper (0.1.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'YoutubePlayerHelper' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

Updating spec repo `trunk`

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  YoutubePlayerHelper (0.1.0) successfully published
 📅  December 5th, 15:05
 🌎  https://cocoapods.org/pods/YoutubePlayerHelper
 👍  Tell your friends!
--------------------------------------------------------------------------------

문제가 있다 번들에 있던 파일을 가져 오지 못한다

Error

Multiple commands produce '/Users/aram/Private/iOS/YoutubePlayerHelper/YoutubePlayerSample/Build/Products/Debug-iphoneos/YoutubePlayerSample.app/Assets.car': 
1) Target 'YoutubePlayerSample' (project 'YoutubePlayerSample') has compile command with input '/Users/aram/Private/iOS/YoutubePlayerHelper/YoutubePlayerSample/YoutubePlayerSample/Assets.xcassets

참고 사이트

Veritas Liberabit Vos