티스토리 뷰

Mobile/iOS

iOS. CFBundleDocumentTypes에 대해서

out of coding 2019. 8. 6. 09:05

이전에 글을 적을때 이것을 왜 사용하는지에 대해서 적지는 않고 그냥 앱스토어 올릴때 워닝 발생하는거 해결하는 방법만 적었습니다.

그래서 이게 무엇인지에 대해서 알아보도록 하죠.

큰 내용은 없습니다. 쏘리

 

일단 어떠한 내용이냐면 앱이 지원하는 파일 타입을 처리하기 위한 방법입니다.

 

이건 예를 들은건데요.

일반적으로 사용하는 이미지 파일의 타입을 만든 사람이 있을것이고...

예를 들어 png, jpeg 이런것들도 포함이 되겠죠?

파일 타입에 대해서 접근할 수 있도록 만드는 앱들이 존재하겠죠.

포토샵도 있고 기타 뷰어들도 있겠죠.

그래서 정의가 필요한것 같네요.

 

애플문서 링크

 

Registering the File Types Your App Supports

Registering the File Types Your App Supports If your app is capable of opening specific types of files, you should register that support with the system. This allows other apps, through the iOS document interaction technology, to offer the user the option

developer.apple.com

애플에서 설명하는 부분에서 다음과 같은 xml이 나옵니다.

plist 파일을 소스로 보게 되면 나오는 건데요.

아래의 내용처럼 사용하여 주면 됩니다.

<dict>
   <key>CFBundleTypeName</key>
   <string>My File Format</string>
   <key>CFBundleTypeIconFiles</key>
       <array>
           <string>MySmallIcon.png</string>
           <string>MyLargeIcon.png</string>
       </array>
   <key>LSItemContentTypes</key>
       <array>
           <string>com.example.myformat</string>
       </array>
   <key>LSHandlerRank</key>
   <string>Owner</string>
</dict>

각 Key들의 설명.
CFBundleTypeName : 타입의 이름
CFBundleTypeIconFiles : 아이콘 리소스 파일들의 array
LSItemContentTypes : 파일 타입의 UTI(Uniform Type Identifier) string array
LSHandlerRank : 해당 타입에 대한 순위를 지정합니다

 

ContentTypes의 정리

 

System-Declared Uniform Type Identifiers

System-Declared Uniform Type Identifiers The following tables list uniform type identifiers (UTIs) that are declared by the system as of OS X v10.4. Note: These tables list only UTIs declared by the system. Other UTIs may be declared privately by Apple app

developer.apple.com

그리고 앱에 접근하려고 할 경우에는 푸시나 스키마 정의 처럼 두곳으로 들어오게 된다고 합니다.

 

앱이 실행중이 아닐때, application: didFinishLaunchingWithOptions:

앱이 실행중일때, application: openURL: sourceApplication: annotation:

 

이 두가지가 불리가 되고.

didFinishLaunching의 경우에는 options에서 다음 값을 가져와서 사용하면 됩니다.

UIApplication.LaunchOptionsKey.url
UIApplication.LaunchOptionsKey.sourceApplication
UIApplication.LaunchOptionsKey.annotation

url, source, annotation를 다 가져올수 있습니다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
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 31
글 보관함