<div dir="ltr">Thank u for ur reply Alex.<div>Sorry for the wrong topic. So I posted my problem on apple forums.</div><div><a href="https://forums.developer.apple.com/message/266174#266174">https://forums.developer.apple.com/message/266174#266174</a><br><div><br><div class="gmail_quote"><div dir="ltr">Alex Blewitt <<a href="mailto:alblue@apple.com" target="_blank">alblue@apple.com</a>>于2017年10月2日周一 下午6:24写道:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">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 <a href="https://forums.developer.apple.com" target="_blank">https://forums.developer.apple.com</a> <div><br></div><div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div>Alex<br></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><blockquote type="cite"><div>On 2 Oct 2017, at 08:23, Yun Zeng via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_3934136903238199181m_-5123627862639051064Apple-interchange-newline"></blockquote></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><blockquote type="cite"><div><div dir="ltr">Hi everyone,<div>Recently I am developing Drag&Drop function on iPad and met a problem: I can not get Pages/Numbers/Keynote files from performDrop in UIDropInteractionDelegate. Here is my solution:</div><div><br></div><div>1. Create my own file item provider, follow the protocol NSItemProviderReading. </div><div>2. <b>override method readableTypeIdentifiersForItemProvider, register UTI of iWorks files which are <font color="#ff0000">com.apple.iwork.pages.sffpages, com.apple.iwork.numbers.sffnumbers and com.apple.keynote.key.</font></b> I got those UTI from <span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">[[</span>NSWorkspace<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1"> </span>sharedWorkspace<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">] </span>typeOfFile<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">:filePath </span>error<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">:</span><span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s2">nil</span><span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">]</span></div><div><span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">3. override </span>+ (<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">instancetype</span>)objectWithItemProviderData:(<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s2">NSData</span> *)data typeIdentifier:(<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s2">NSString</span> *)typeIdentifier error:(<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s2">NSError</span> * <span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">_Nullable</span> <span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">__autoreleasing</span> *)outError</div><div>4. implement canHandleSession of UIDropInteractionDelegate and return <span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">[session </span>canLoadObjectsOfClass<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">:[</span><span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s2">DTFileItemProvider</span><span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1"> </span>class<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-s1">]]</span></div><div><br></div><div>I do the same thing on office files, and it work very well, I can get file's data in performDrop. But iWorks file are not.</div><div><br></div><div>So did I set the wrong UTI or something?</div>
</div><div dir="ltr">-- <br></div><div class="m_3934136903238199181m_-5123627862639051064gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">Zeng Yun</div><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">iOS Engineer</div><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">Email/QQ:<span class="m_3934136903238199181m_-5123627862639051064inbox-inbox-Apple-converted-space"> </span><a href="mailto:zengyun.programmer@gmail.com" target="_blank">zengyun.programmer@gmail.com</a></div></div></div></div></blockquote></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><blockquote type="cite"><div>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div></div></div></blockquote></div></div></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">Zeng Yun</div><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">iOS Engineer</div><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;line-height:19.5px">Email/QQ:<span class="inbox-inbox-Apple-converted-space"> </span><a href="mailto:zengyun.programmer@gmail.com" target="_blank">zengyun.programmer@gmail.com</a></div></div></div>