SlideShare una empresa de Scribd logo
1 de 78
Descargar para leer sin conexión
App Extensions in iOS
李 俊河
• App Extensions란?
• Extension Point의 종류
• App Extensions의 기초 동작
1. App Extensions의 라이프 사이클

2. App Extensions의 데이터 전달방법

- App Groups

- Embedded Framework

- NSUserDefaults의 경우

- CoreData의 경우

• 주의사항
iOS8 & OS X - Yosemite부터 새로 추가된 개념으로써
App Extensions란?
공유, 통지센터, 키보드 등 iOS 시스템의 특정 영역과
연결지어서 그 영역의 기능을 확장시켜줍니다
App Extensions란?
그 각각의 영역을 Extension Point 라고 합니다
App Extensions란?
Extension Point의 종류는 조금 있다가 하구요
App Extensions란?
그 전에 두가지 용어의 개념을 알고 지나갑시다
App Extensions란?
Host app 과 Containing app
App Extensions란?
먼저 Host app 부터 설명드리자면
App Extensions란?
유저가 App Extensions를 선택할 수 있도록
되어있는 어플을 말합니다
App Extensions란?
Safari , Photo(기본 사진앱) 등이 여기에 속합니다
App Extensions란?
그 다음 Containing app 은요
App Extensions란?
App Extensions가 포함되어 있는 어플을 지칭합니다
App Extensions란?
참고로 Containing app에는
App Extensions란?
몇개든지 App Extensions를 넣을 수 있다고 합니다
(확인 안해봄)
App Extensions란?
이제 Extension Point에 어떤 종류가 있는지 알아보죠
App Extensions란?
• Extension Point는 크게 7가지 종류가 있습니다.
Extension Point의 종류
Today
Share
Action
Photo Editing
Finder Sync
Document Provider
Custom Keyboard
Extension Point의 종류
Today
• 앱을 기동하지않고 해당 앱의 일부
기능들을 간이 형식으로 쓸 수 있게
하는 Extension

• 위젯이라고도 부름
Extension Point의 종류
Share
• Host app 에 있는 버튼을 눌러
정보를 SNS등으로 타 유저와 공유
하는 Extension
Extension Point의 종류
Action
• Host app 상에서 표시되는 컨텐츠
를 조작 혹은 표시하는 Extension
Extension Point의 종류
Photo Editing(iOS Only)
• 사진(iOS 기본앱)으로 사진이나
동영상을 편집하는 Extension
Extension Point의 종류
Photo Editing(iOS Only)
• 사진(iOS 기본앱)으로 사진이나
동영상을 편집하는 Extension

• 사진 앱 안에서 해당 Extension을
추가로 불러서 그 기능을 빌려쓰는
느낌
Extension Point의 종류
Finder Sync(OS X Only)
• 파일의 동기상태에 관한 정보를
Finder에 직접 표시하는 Extension
Extension Point의 종류
Document provider(iOS Only)
• Containing app 안에 있는 파일
을 Host app이 조작할 수 있도록
하는 Extension
Extension Point의 종류
Document provider(iOS Only)
• Containing app 안에 있는 파일
을 Host app이 조작할 수 있도록
하는 Extension

• Import / Export / Open / Move
의 조작을 할 수 있음

• 각 조작은 직접 구현할 필요가 있음
Extension Point의 종류
Custom Keyboard(iOS Only)
• 키보드를 커스터마이징 해서 여러
앱 상에서 사용 가능하도록 하는
Extension
–Johnny Appleseed
1. 유저가 App Extension 선택
App Extensions의 기초 동작
App Extensions의 라이프 사이클
–Johnny Appleseed
2. 시스템이 App Extension 실행
App Extensions의 기초 동작
App Extensions의 라이프 사이클
–Johnny Appleseed
3. App Extension 코드 실행
App Extensions의 기초 동작
App Extensions의 라이프 사이클
–Johnny Appleseed
4. 시스템이 App Extension 종료
App Extensions의 라이프 사이클
App Extensions의 기초 동작
Host app과 Containing app은 직접 통신할 수 없습니다
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
그래서 그 사이를 App Extension이 연결시켜주는 방법으로
통신을 합니다
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
그 전에
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
Host app App Extension Containing app간에
데이터를 공유하려면 두가지 사전준비가 필요합니다
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
사전준비 1. App Groups
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
App Extensions의 기초 동작
App Groups
App Extension과 Containing app이 서로의 데이터를 하나의
Group Id를 가진 공용 컨테이너 안에서 공유 할수있게 합니다
App Extensions의 기초 동작
App Groups
iOS DevCenter에서 「App groups」를 생성합니다
App Extensions의 기초 동작
App Groups
실제 프로젝트에서
Targets→Capabilities→App Groups를 ON
App Extensions의 기초 동작
App Groups
그 후 표시되는 App Groups를 확인한 뒤 체크표시를 하면 해
당 Target에 해당하는 「.entitlements」파일이 생성됩니다
App Extensions의 기초 동작
App Groups
App Extension쪽의 Target에도 같은 처리를 해주면
완료입니다
사전준비 2. EmbeddedFramework
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
App Extensions의 기초 동작
EmbeddedFramework
App Extension과 Containing app이
공통된 클래스나 리소스를 사용할 때 필요합니다
App Extensions의 기초 동작
EmbeddedFramework
프로젝트 상에서 File→New→Target을 선택
App Extensions의 기초 동작
EmbeddedFramework
Framework&Library → Cocoa Touch Framework 선택
App Extensions의 기초 동작
EmbeddedFramework
적당히 이름을 채워넣으면 생성완료
App Extensions의 기초 동작
EmbeddedFramework
Targets에 이런식으로 표시됩니다
App Extensions의 기초 동작
EmbeddedFramework
General → Deployment Info → App Extensions의
Allow app extension API only 항목에 체크
App Extensions의 기초 동작
EmbeddedFramework
프로젝트의Target → General → Embedded Binaries와
Linked Frameworks and Libraries에 생성한 EmbeddedFramework가
존재하는지 확인 후 존재하지 않으면 추가시켜줍니다
App Extensions의 기초 동작
EmbeddedFramework
App Extensions의 Target에도 같은 확인을 합니다
(Linked Frameworks and Libraries만)
App Extensions의 기초 동작
EmbeddedFramework
공용할 클래스의 .h파일을 EmbeddedFramework Target의 Build
Phases→ Headers→Project에 추가합니다
App Extensions의 기초 동작
EmbeddedFramework
공용할 클래스의 .m파일은 EmbeddedFramework Target의 Build
Phases→ Compile Sources에 추가합니다
App Extensions의 기초 동작
EmbeddedFramework
공용할 클래스 중 EmbeddedFramework외부에서 사용할 클래스는
해당 .h파일을 Headers→Project에서 Headers→Public로 이동시킨 뒤
App Extensions의 기초 동작
EmbeddedFramework
EmbeddedFramework를 생성할때 함께 만들어진 .h파일
(이 경우에서는 EmbeddedDB.h)의 밑에 아래와 같은 방식으로 써줍니다
App Extensions의 기초 동작
EmbeddedFramework
실제 사용할 클래스에서는 @import 방식으로 선언해주면 OK
이제 사전준비가 끝났으니
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
실제로 공용 컨테이너를 쓰는 법을 알아봅시다
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
우선은 제일 사용도가 높은(?) NSUserDefaults를
이용하는 경우에 대해서 알아보죠
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
initWithSuiteName:으로 AppGroups Id를 지정하여 인스턴스 생성
App Extensions의 기초 동작
NSUserDefaults의 경우
값을 생성하거나 불러올때는 평범한 NSUserDefaults 처럼 쓰면 OK
App Extensions의 기초 동작
NSUserDefaults의 경우
다음은 CoreData의 경우
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
실제 DB파일을 읽고 쓸 저장위치를
containerURLForSecurityApplicationGroupIdentifier: 로
AppGroups Id를 지정해주면 OK
App Extensions의 기초 동작
Core Data의 경우
이렇게 저장되는 정보는 private/var…에 존재하는 appGroups전용 폴
더로 들어가기 때문에 탈옥을 하지 않는이상은 안전(?) 하다고 봅니다
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
참 쉽죠?
App Extensions의 기초 동작
App Extensions의 데이터 전달방법
App Extensions의 기초 동작
은(는) 4일 해멤
이런 Extension을 이용하기 위한
몇가지 주의사항에 대해서 이야기 하고자 합니다
주의사항
1. iOS8에서만 사용 가능합니다
주의사항
EmbeddedFramework와 관련된 이유가 있습니다만
주의사항
App Extension자체가 iOS8부터 지원하기 때문이 가장 큽니다
주의사항
2. Extension을 적용할 앱에는 64비트(arm64) 대응이 필수입니다
주의사항
이건 뭐 올해 1월부터 애플에서 권고되던 사항이기에
자세한 설명은 생략하겠습니다
주의사항
3. App Extension상에서 사용할 수 없는 API가 존재합니다
주의사항
헤더파일에 NS_EXTENSION_UNAVAILABLE 등의
매크로가 붙어있는 API는 사용 할 수 없습니다
주의사항
4. 카메라와 마이크를 이용할 수 없습니다
주의사항
5. 백그라운드 상에서 장시간 태스크를 실행할 수 없습니다
(플랫폼마다 다름、자세히 확인 안해봄)
주의사항
6. 직접적으로 AirDrop을 사용해서 데이터를 송・수신할 수 없습니다
주의사항
주의사항
대신 UIActivityViewController클래스를 사용함으로써
기존 어플리케이션과 같이 AirDrop을 이용하면 가능하다 합니다
참고자료
https://developer.apple.com/jp/documentation/UserExperience/Conceptual/MobileHIG/AppExtensions/AppExtensions.html
http://www.raywenderlich.com/83809/ios-8-today-extension-tutorial
http://qiita.com/monoqlo/items/6ed93f0d2e719acd9474
http://www.cnet.com/how-to/how-to-set-up-ios-8-action-extensions-in-safari/
http://dev.classmethod.jp/smartphone/ios8-photo-kit-9/
http://qiita.com/takebayashi/items/f29617d56ceed9ee7e9d
http://www.macstories.net/mac/extensibility-and-automation-changes-in-os-x-yosemite/
http://www.slideshare.net/ssuser9c7e21/document-provider
https://itunes.apple.com/jp/app/morse-code-telegraph-keyboard/id921290705?mt=8
http://dev.classmethod.jp/references/ios-8-app-extension-5/
http://dev.classmethod.jp/references/ios-8-app-extension-6/
http://dev.classmethod.jp/references/ios-8-action-extension/
http://swift-studying.com/blog/swift/?p=508
http://dev.classmethod.jp/references/ios-8-embedded-framework/
http://techblog.yahoo.co.jp/ios/today-widget/
http://stackoverflow.com/questions/24641768/accessing-core-data-sql-database-in-ios-8-extension-sharing-data-
between-app-an
https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/index.html
끝입니다

Más contenido relacionado

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Extension in iOS ver KR