<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">This isn't an appropriate question for the swift-evolution list. You might like to ask it on one of the Apple developer forums at&nbsp;<a href="https://forums.developer.apple.com" class="">https://forums.developer.apple.com</a>&nbsp;<div class=""><br class=""></div><div class="">Alex<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Oct 2017, at 08:23, Yun Zeng via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi everyone,<div class="">Recently I am developing Drag&amp;Drop function on iPad and met a problem: I can not get Pages/Numbers/Keynote files from&nbsp;performDrop in&nbsp;UIDropInteractionDelegate. Here is my solution:</div><div class=""><br class=""></div><div class="">1. Create my own file item provider, follow the protocol NSItemProviderReading.&nbsp;</div><div class="">2. <b class="">override method readableTypeIdentifiersForItemProvider, register UTI of iWorks files which are <font color="#ff0000" class="">com.apple.iwork.pages.sffpages, com.apple.iwork.numbers.sffnumbers and com.apple.keynote.key.</font></b> I got those UTI from&nbsp;<span class="inbox-inbox-s1">[[</span>NSWorkspace<span class="inbox-inbox-s1"> </span>sharedWorkspace<span class="inbox-inbox-s1">] </span>typeOfFile<span class="inbox-inbox-s1">:filePath&nbsp;</span>error<span class="inbox-inbox-s1">:</span><span class="inbox-inbox-s2">nil</span><span class="inbox-inbox-s1">]</span></div><div class=""><span class="inbox-inbox-s1">3. override&nbsp;</span>+ (<span class="inbox-inbox-s1">instancetype</span>)objectWithItemProviderData:(<span class="inbox-inbox-s2">NSData</span> *)data typeIdentifier:(<span class="inbox-inbox-s2">NSString</span> *)typeIdentifier error:(<span class="inbox-inbox-s2">NSError</span> * <span class="inbox-inbox-s1">_Nullable</span> <span class="inbox-inbox-s1">__autoreleasing</span> *)outError</div><div class="">4. implement canHandleSession of&nbsp;UIDropInteractionDelegate and return&nbsp;<span class="inbox-inbox-s1">[session </span>canLoadObjectsOfClass<span class="inbox-inbox-s1">:[</span><span class="inbox-inbox-s2">DTFileItemProvider</span><span class="inbox-inbox-s1"> </span>class<span class="inbox-inbox-s1">]]</span></div><div class=""><br class=""></div><div class="">I do the same thing on office files, and it work very well, I can get file's data in&nbsp;performDrop. But iWorks file are not.</div><div class=""><br class=""></div><div class="">So did I set the wrong UTI or something?</div>



































</div><div dir="ltr" class="">-- <br class=""></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div style="color:rgb(117,117,117);font-family:&quot;helvetica neue&quot;,helvetica,arial,sans-serif;line-height:19.5px" class="">Zeng Yun</div><div style="color:rgb(117,117,117);font-family:&quot;helvetica neue&quot;,helvetica,arial,sans-serif;line-height:19.5px" class="">iOS Engineer</div><div style="color:rgb(117,117,117);font-family:&quot;helvetica neue&quot;,helvetica,arial,sans-serif;line-height:19.5px" class="">Email/QQ:<span class="inbox-inbox-Apple-converted-space">&nbsp;</span><a href="mailto:zengyun.programmer@gmail.com" target="_blank" class="">zengyun.programmer@gmail.com</a></div></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>