iMessage Extension: Unable to customize the sent attachment's name

I'm using the API below to insert a file in iMessage context, and i'm using the alternate file name to customize my sent attachment's name. However, it seemingly doesn't work.

- (void)insertAttachment:(NSURL *)URL withAlternateFilename:(NSString *)filename completionHandler:(void (^)(NSError *))completionHandler;

Maybe it's a bug? Or just because the API is not finished?

Hoping to get some answer, thanks in advance!

Replies

It sounds like this might be a bug. It would be best to file a bug report and attach a small sample project showing the issue. Please post the bug number here.

Hi pdm:

I want to make two problems clear:


1.In iOS 10 iMessage extension I insert attachment by “insertAttachment:”API, and passed parameters of filename, but when I insert it to iMessage input box, the attachment name is not what I set, it’s the one that system generated itself.


2.When I insert a linkage by “insertText:”API, the recipient will receive two linkages stitched together. For example: when I send http://www.wps.cn ,the recipient will receive http://www.wps.cnhttp://www.wps.cn


Thank you

I'm also having this issue. Still happening as of Xcode 8.1. I open a bug with apple the number is 28030025, still open and not marked as a duplicate.

https://forums.developer.apple.com/message/170090#170090

Still not working in Xcode 10, iOS12 - i filed a radar 45337644

I'm using Xcode 11.4 and iOS 13.2. This still doesn't work. What I'm getting instead for the file name is a generated string like `ms-nQeHmF.mp3`. This can't be hard to fix.