Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- FileOwner
- 앱버전구하기
- jQuery
- Python
- iOS계산기
- 파이썬서버
- DispatchGroup
- 맥
- 계산기앱
- AJAX
- 계산기앱만들기
- spring
- 앱배포
- MainScheduler
- customclass
- Xcode
- JavaScript
- 웹
- 스위프트
- iOS앱배포
- 개발기록
- iOS배포
- 딩동말씀
- FLASK
- subscript
- ios
- Xib
- 스프링
- Swift
- 자바스크립트
Archives
- Today
- Total
개발하는 뚝딱이
[iOS] iOS + Realm 모델 사용하기 본문
Xcode 프로젝트 + Realm 연동
1. CocoaPod 설치하기
$ sudo gem install cocoapods
2. 터미널 - 프로젝트 경로로 이동, 아래 명령어 입력
(파인더로 해당 프로젝트 이동하면, Podfie 생성 확인 가능)
$ pod init
3. 생성된 Podfile 수정
(두번째 단락에 pod 'RealSwift' 추가해주었음 / Realm 외에도 필요한 모듈 추가 가능)
$ vim Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'RealmDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'RealmSwift'
# Pods for RealmDemo
end
4. XCode 12 버전을 사용한다면 Podfile에 추가해주기!
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
config.build_settings['EXCLUDED_ARCHS[sdk=watchsimulator*]'] = 'arm64'
config.build_settings['EXCLUDED_ARCHS[sdk=appletvsimulator*]'] = 'arm64'
end
end
end
*** 참고
5. 추가한 모듈 설치해주기
$ pod install
TroubleShooting
1. 연동했으나, RealmSwift 모듈을 찾지 못하는 경우
3. Realm에서 사용하는 모델을 변경하였을 시점에 어떠한 데이터라도 정의되어 있는 모델이면 코드에 정의된 모델과 디스크에 기록된 모델 사이에 불일치가 발생. 이러한 상황이 발생할 때 기존 파일을 열려고 하면 마이그레이션이 진행되지 않고 예외처리
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=10 "Migration is required due to the following errors:
'iOS 개발일지' 카테고리의 다른 글
[iOS] 딩동환율 업데이트 일지 (0) | 2022.02.06 |
---|---|
[iOS] 딩동말씀 앱 출시 후기 (2) | 2021.06.12 |
[iOS] iOS Device Support (0) | 2020.09.17 |
[iOS] 스크린샷 찍고 앨범에 저장하기 (0) | 2020.07.01 |
[iOS] Firebase 연동하기 (0) | 2020.06.30 |