Skip to content

iOS 개발환경 세팅

Lee Jaeyoung edited this page Aug 12, 2021 · 8 revisions

0. Xcode 환경

Tool Version
Mac OS MacOS BigSur Version 11.4
Xcode Version 12.5.1

1. App 프로젝트 생성

1) Xcode 에서 새 프로젝트 만들기를 선택합니다. (iOS → App)

1

2) 다음과 같이 프로젝트의 옵션을 설정 해줍니다.

Product Name = "saver-ios"

Organiziation Identifier = "saver.42seoul.io"

Interface = "Storyboard"

Life cycle = "UIKit App Delegate"

Language = "Swift"

2

3) WebKit 사용을 위한 세팅

saver-ios 프로젝트 설정 → Build Phases → Link Binary With Libraries 항목에서

WebKit.framework 를 추가해줍니다.

3

4) http 통신 허용

info.plist 파일에서 App Transport Security Settings 항목을 추가하고, 해당 항목 안에 Allow Arbitrary Loads 항목을 추가한 후 Value 를 YES 로 설정합니다.

4

2. 프로젝트에 Firebase 추가

1) Firebase console에서 새 프로젝트를 추가합니다. (국가 - 대한민국)

5

2) iOS 앱에 Firebase 추가 버튼을 눌러서 절차를 진행한다.

6

3) GoogleService-info.plist는 Saver-ios 파일 안에 저장하고 pod 을 생성합니다.

(cocoa pods가 없는 경우 → brew install cocoapods)

iterm을 켜서 saver-ios.xcodeproj 파일이 있는 'saver-ios' 디렉토리에서 pod init 을 수행하고,

만들어진 podfile에 다음 코드를 추가합니다.

# add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# or pod ‘Firebase/AnalyticsWithoutAdIdSupport’
# for Analytics without IDFA collection capability

# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods

그 후 pod install 명령을 실행하면 설치 완료

7

<pod install 유의사항>

pod install 시 CocooaPods 1.10.0 이상의 버전을 요구함으로 이전 brew install cocoapods 작업 수행 시 버전에 유의해야합니다.

혹 실수로 낮은 버전을 받았을 시에는 아래 명령어로 버전을 확인하고

pod --version

아래 명령어로 업데이트 시켜주고

sudo gem install cocoapods -v 1.10.1

pod install 재시도합니다.


개발은 saver-ios.xcworkspace 에서 진행한다.

8

4) 초기화 코드 추가

AppDelegate.swift 파일의 class 안에 다음의 코드를 추가한다. 이 작업을 통해 앱을 시작할 때 Firebase에 연결된다.

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions:
      [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()
    return true
  }
}
9

3. Config 파일 추가

saver-ios/Config.xcconfig 파일을 추가한다.

Clone this wiki locally