When sharing the link through the app does not load either photo or text in the iPhone version. Android works perfect

Asked

Viewed 70 times

0

Hello, I have an app developed in Flutter. It has a list of news that the user can share. I’m using the Dart Packages share plugin. On android the sharing is working perfectly, I pass the link of the item on the web and android loads the photo and the title and form the set. Already on iPhone is not working. In fact it shares, but does not load either the title, nor the photo. Can someone give me a hint of where I’m going wrong? Below I will post the code of the page with the list of news and the implementation of the sharing in the method _shareLink(String text).

The result of the code on Android and iPhone are in the images below:

On Android: Resultado no Android

On the iPhone: Resultado no Iphone


import 'package:alba_app/helpers/noticia_helper.dart';
import 'package:alba_app/models/noticia_model.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:share/share.dart';

class PlaceNoticiaWidget extends StatefulWidget {
  PlaceNoticiaWidget();

  @override
  PlaceNoticiaWidgetState createState() => PlaceNoticiaWidgetState();
}

class PlaceNoticiaWidgetState extends State<PlaceNoticiaWidget> {
  NoticiaHelper helperNoti = NoticiaHelper();
  NoticiaModel noti = NoticiaModel();
  List<NoticiaModel> listNotis = List();
  String path;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    helperNoti.getAllNoticias().then((list) {
      setState(() {
        listNotis = list;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: listaNoticias(),
    );
  }

  listaNoticias() {
    return ListView.separated(
        padding: EdgeInsets.only(left: 0.0, top: 5.0, right: 0.0, bottom: 5.0),
        separatorBuilder: (context, index) => Divider(color: Colors.black54),
        itemCount: listNotis.length,
        itemBuilder: (context, index) {
          return ListTile(
            title: Text(
              listNotis[index].dataNoticia,
              style: TextStyle(fontSize: 16, color: Colors.black87),
            ),
            subtitle: Text(
              listNotis[index].titleNoticia,
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
                color: Colors.black,
              ),
              maxLines: 2,
            ),
            leading: Image.network(
              listNotis[index].fotoNoticia,
            ),
            onTap: () {
              showDialog(
                  context: context,
                  builder: (context) => AlertDialog(
                    title: Text("Qual o seu desejo?"),
                    content: Text(
                      listNotis[index].titleNoticia,
                      style: TextStyle(fontWeight: FontWeight.bold),
                    ),
                    actions: <Widget>[
                      FlatButton(
                        onPressed: (){
                          _launchURL(listNotis[index].linkNoticia);
                          Navigator.of(context).pop(true);
                        },
                        child: Text("Ler a íntegra da noticia!"),
                      ),
                      FlatButton(
                        onPressed: (){
                          _shareLink(listNotis[index].linkNoticia);
                          Navigator.of(context).pop(true);
                        },
                        child: Text("Compartilhar"),
                      ),
                      FlatButton(
                          onPressed: (){
                            Navigator.of(context).pop(true);
                          },

                          child: Text('FECHAR'))
                    ],
                  ));
            },
          );
        });
  }

  _launchURL(String urlNew) async {

    var url = urlNew;
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _shareLink(String texto) async {
    await Share.share(texto);
  }

}

Today I got a physical device to run the application. Debugging appeared an error when triggered the sharing function. Below put the error that appears on the console.

========


WF: _WebFilterIsActive returning: NO
WF: _userSettingsForUser mobile: { 
     filterBlacklist = ();
     filterWhitelist = ();
     restrictWeb = 1;
     useContentFilter = 0;
     useContentFilterOverrides = 0;
     whitelistEnabled = 0;
  }
WF: _WebFilterIsActive returning: NO
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 

Can someone give me a light on how to solve this problem?

  • As it is a specific iOS problem becomes more difficult to help, however you can add images of the two system to further detail the problem.

  • 1

    @rubStackOverflow, I posted the image with the result of the share action in both applications. What I want to know is if I’m passing some specific iPhone configuration, in using the plugin.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.