1

I have successfully created an iMessage extension where the sender can choose an image, type text on top of the image and then send the new image and text combined to another recipient.

Currently, when the recipient taps the received message, it takes them to the iMessage App Store to download the app.

What I would like is for the recipient to NOT be redirected to the app store, but simply be presented with a larger view of the image they received.

Any help on how to achieve this (if possible) would be appreciated!


Edited: After more research, I'm wondering if it's possible to send the newly created image (containing the image and text combined) as a MSSticker so when the user taps it, it simply enlarges?

Dima
  • 23,484
  • 6
  • 56
  • 83
  • You can do this in mac where link will help to navigate to open the large image but we cannot restrict user to open the app store as it is not controlled by us in iPhone/iPad. – Shrawan Nov 16 '16 at 19:26

2 Answers2

0

Sending the image as a Message follows the MSMessage format (clicking on the message will direct a user to the app or app store). You can either send the image as a sticker or insert the image into the conversation!

0

(In case anyone's looking for belated enlightenment).

If you sent the image you create as an Attachment then it appears in the receiver's stream as just an image, without being associated with an app. Only when you send an MSMessage does the signature matching kick in and require the receiver to have the app.

See my im-plausibilities sample for a demo, specifically

func sendAttachment() {
    guard let conversation = activeConversation else { fatalError("Expected a conversation") }
    guard
        let imageData = imageView?.image?.jpegData(compressionQuality: 0.8),
        let docUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
        else {
            dismiss()
            return
    }

    // WARNING this is not great practice - not robust if muliple messages sent without completing upload
    attachmentPath = URL(fileURLWithPath: "imPhoto.jpg", relativeTo: docUrl)
    if (try? imageData.write(to: attachmentPath!)) != nil {
        conversation.insertAttachment(attachmentPath!, withAlternateFilename: "imPhoto.jpg") { (error) in
            if let error = error {
                os_log("Error with insertAttachment(message)")
                print(error)
            }
        }
    }
    dismiss()
}
Andy Dent
  • 17,578
  • 6
  • 88
  • 115