私は、ユーザーが他のユーザーと興味のあるポイントを共有できるように、自分のアプリケーション用に新しいドキュメントUTIを作成しようとしています。カスタムUTIがアプリで開かない
- それ
- に対応するエクスポートUTIを作成した.plist
- でドキュメントタイプを作成します。私はSOに理解できるものから、チュートリアル、およびアップルのドキュメントから、次の操作を行う必要がありますメソッドを使用します。 - (BOOL)アプリケーション:(のUIApplication *)アプリケーション didFinishLaunchingWithOptions:私が理解から、(NSDictionaryの*)launchOptions
、限り、あなたは右のそれらをしたとして、あなたはファイルを開くことができるはずですメールで問題なくs。残念ながら、私のカスタムUTIではうまくいきません。私はMailで「Open with ...」のリストに自分のアプリケーションを表示していますが、私がそれを選択すると、私のAppはまったく開きません。それは、アプリケーションが開いていないときだけでなく、アプリケーションが開いているときにも何でもしません。メールは残っており、何も起こりません。私はまた、 "主催者"を使用してコンソールをチェックし、何も起こることは絶対にありません。
元々私のplistが間違っていると思っていたので、公開UTI(com.adobe.pdfドキュメントタイプを追加)をテストし、アプリはちゃんと起動しました(実際にPDFをサポートしていないので;))。しかし、問題はそれが何の問題もなく立ち上げられたということでした。
私はそれが問題であるかもしれないと思う唯一のことは、ファイルを作成する方法です。私は(エクスポートすることもAppで)このメソッドを使用することにより、電子メールにファイルを作成しています:
MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
[picker setSubject:[NSString stringWithFormat:@"My place: %@",POIName]];
[picker addAttachmentData:customPOIData mimeType:@"application/customPOI" fileName:[NSString stringWithFormat:@"%@.icp",POIName]];
[picker setMessageBody:@"Check out this great place I found!" isHTML:NO];
[picker setMailComposeDelegate:self];
[self presentModalViewController:picker animated:YES];
はそれに何か問題はありますか?
CFBundleDocumentTypes:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Custom POI</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.imadev.icp</string>
</array>
</dict>
</array>
UTExportedTypeDeclarations:
はまた、ここに私のplistのコードである
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Custom POI</string>
<key>UTTypeIdentifier</key>
<string>com.imadev.icp</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>icp</string>
</array>
<key>public.mime-type</key>
<string>application/customPOI</string>
</dict>
</dict>
</array>
おかげで任意の助けのためにたくさん! -Mark