iOS 앱 전용 독점 UTI 유형을 작성/내보내려고합니다. Instagram이 독점적으로 UTI com.instagram.exclusivegram을 처리하는 방식과 매우 유사합니다.독점 iOS UTI
기본적으로 com.photoapp.photo는 사진을 찍기 위해 등록 된 모든 앱에서 사진을 열 수있게하려는 경우 (com.instagram.photo와 유사) 앱에서 사용할 수 있도록하려는 것입니다. 그렇다면 com.photoapp.exclusive 만 내 앱에서 열 수 있어야합니다 (com.instagram.exclusivegram과 유사).
내 장치에서 실행중인 것은 com.photoapp.exclusive를 사용하는 경우에도 UIDocumentController가 PhotoApp 또는 DropBox 중 어디에서나 PhotoApp를 열 것인지 묻는 메시지를 표시합니다.
개방형 기능을 확인하는 데 사용하는 예제 앱은 물론 UTI를 등록하는 앱이 있습니다.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"photoapp://"]]) {
NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"derp.png"], 1.0);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fullPathToFile = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"photoapp.pae"];
[imageData writeToFile:fullPathToFile atomically:NO];
interactionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"file://%@", fullPathToFile]]];
interactionController.UTI = @"com.photoapp.exclusive";
interactionController.delegate = self;
[interactionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
}
그리고 여기 내 애플 리케이션에 대한 내 PLIST 파일에 내가 무엇을 가지고 : 나는 예제 응용 프로그램에서 사용하고있는 코드는 다음과 같습니다 즉시이 같은 UTI를 지정으로
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>Exclusive PhotoApp Photo</string>
<key>UTTypeConformsTo</key>
<array>
<string>com.photoapp.photo</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.photoapp.exclusive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pae</string>
</dict>
</dict>
<dict>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pa</string>
</dict>
<key>UTTypeIdentifier</key>
<string>com.photoapp.photo</string>
<key>UTTypeDescription</key>
<string>PhotoApp Photo</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.png</string>
<string>public.jpeg</string>
</array>
</dict>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>LSItemContentTypes</key>
<array>
<string>com.photoapp.exclusive</string>
<string>com.photoapp.photo</string>
</array>
<key>CFBundleTypeName</key>
<string>Photo</string>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
</array>
파일 형식이 'public.png' 또는'public.jpeg' 또는 이와 유사한 것을 지정하면 곧 이러한 UTI 파일을 열 수 있음을 지정하는 모든 앱에서 해당 파일을 열 수 있습니다. 'UTTypeConformsTo' 배열을 삭제하면 문제가 해결됩니다. – Greg
즉,'com.photoapp.exclusive'가'com.photoapp.photo'를 따르도록 지정하지 마십시오. 'com.photoapp.photo'를 그대로 두어,'com.photoapp.exclusive'에 대한 준수를 지정하지 말아주세요. – Greg
고마워요! 당신의 대답을 받아 들일 수 있도록 의견을 말하고 싶습니까? – joshholat