3

I have implemented dynamic links into a flutter app I am working on. They are working as expected on everything I have tested EXCEPT iMessage. What is odd is if I copy and paste the link from the share popup, the message appears and send correctly. However, if I share it directly to iMessage (without the copy/paste step) the text preview is fine, but when it send it only shows the long link and not any of the preview meta data.

Link Generation:

class DynamicLinkService {
Future<Uri> createDynamicLink(String navPage, String id) async {
    final DynamicLinkParameters parameters = DynamicLinkParameters(
      uriPrefix: 'https://example.page.link',
      link: Uri.parse('https://example.com/?navPage=$navPage&id=$id'),
      androidParameters: AndroidParameters(
        packageName: 'com.example.example',
        minimumVersion: 1,
      ),
      iosParameters: IosParameters(
        bundleId: 'com.example.example',
        minimumVersion: '1',
        appStoreId: '12345678',
      ),
    );
    var dynamicUrl = await parameters.buildShortLink();
    final Uri shortUrl = dynamicUrl.shortUrl;
    return shortUrl;
}

On press link generation:

class _FeedPageWidgetState extends State<FeedPageWidget>
  final DynamicLinkService _dynamicLinkService = DynamicLinkService();

Align(
alignment: AlignmentDirectional(0, 0),
child: FlutterFlowIconButton(                                 
 icon: Icon(),
    onPressed: () async {
    var uri = await _dynamicLinkService
    .createDynamicLink('param 1', 'param 2');
    await Share.share(uri.toString());
    print(uri.toString());
    },
  ),
),

Below are some image examples of what I am seeing: Image preview selecting iMessage directly from the share popup.

enter image description here

Image of link after sending. Notice it only shows the full dynamic link.

enter image description here

Image showing copying and pasting the dynamic link from the share pop-up. Notice how it sends correctly in this manner.

enter image description here

Any help on this?

Dennis Ashford
  • 872
  • 2
  • 7
  • 21
  • I have this same issue... Sharing via WhatsApp or just copying works fine, so what is going on with iMessage... – James Sep 16 '22 at 20:58
  • 1
    @James the only way I could find to fix this was adding some text before the link. If there is also a text message being sent, then the link preview works fine. Not really sure why though. – Dennis Ashford Sep 19 '22 at 11:35

0 Answers0