masashi-sutou / flutter_ios_voip_kit

One-to-one video call using CallKit and PushKit with flutter iOS app.
MIT License
67 stars 45 forks source link

Getting voip token returns a null value #31

Closed Bavon101 closed 3 years ago

Bavon101 commented 3 years ago

I'm using the getVoIPToken() method and it returns a null token every time, what could be causing this?

rekonvald commented 3 years ago

Hi! Have you solved this issue? Have null token also

Bavon101 commented 3 years ago

Hi! Have you solved this issue? Have null token also

Not yet

Bavon101 commented 3 years ago

Hi! Have you solved this issue? Have null token also

Hello @rekonvald , I think I know what the issue is, on my side, I've found out that VOIP services don't work on simulators, ran the app on a real device, and got the token. If you're running the app on a simulator, please try the real device

ntorres0612 commented 3 years ago

¡Hola! ¿Ha resuelto este problema? Tener token nulo también

Hola @rekonvald , creo que sé cuál es el problema, por mi parte, descubrí que los servicios VOIP no funcionan en simuladores, ejecuté la aplicación en un dispositivo real y obtuve el token. Si está ejecutando la aplicación en un simulador, pruebe el dispositivo real

Hello @Bavon101 The persistent problem in a physical device

Bavon101 commented 3 years ago

¡Hola! ¿Ha resuelto este problema? Tener token nulo también

Hola @rekonvald , creo que sé cuál es el problema, por mi parte, descubrí que los servicios VOIP no funcionan en simuladores, ejecuté la aplicación en un dispositivo real y obtuve el token. Si está ejecutando la aplicación en un simulador, pruebe el dispositivo real

Hello @Bavon101 The persistent problem in a physical device

You have a VoIP key cert with the current bundle id ?

ntorres0612 commented 3 years ago

¡Hola! ¿Ha resuelto este problema? Tener token nulo también

Hola @rekonvald , creo que sé cuál es el problema, por mi parte, descubrí que los servicios VOIP no funcionan en simuladores, ejecuté la aplicación en un dispositivo real y obtuve el token. Si está ejecutando la aplicación en un simulador, pruebe el dispositivo real

Hello @Bavon101 The persistent problem in a physical device

You have a VoIP key cert with the current bundle id ?

¡Hola! ¿Ha resuelto este problema? Tener token nulo también

Hola @rekonvald , creo que sé cuál es el problema, por mi parte, descubrí que los servicios VOIP no funcionan en simuladores, ejecuté la aplicación en un dispositivo real y obtuve el token. Si está ejecutando la aplicación en un simulador, pruebe el dispositivo real

Hello @Bavon101 The persistent problem in a physical device

You have a VoIP key cert with the current bundle id ?

Yes, I already have my bunddle id registered

Bavon101 commented 3 years ago

Even VoIP enabled on Background mode in xcode?

ntorres0612 commented 3 years ago

¿Incluso VoIP habilitado en el modo de fondo en xcode?

Yes, background modes is checked

image

Bavon101 commented 3 years ago

Can you please share your code snippet where you're calling the token function?

ntorres0612 commented 3 years ago
> Can you please share your code snippet where you're calling the token function?

import 'package:flutter/material.dart';
import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart';

class CallPage extends StatefulWidget {
  CallPage({Key key}) : super(key: key);

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

class _CallPageState extends State<CallPage> {
  final voIPKit = FlutterIOSVoIPKit.instance;

  @override
  void initState() {
    super.initState();
    _showRequestAuthLocalNotification();

    voIPKit.onDidReceiveIncomingPush = (
      Map<String, dynamic> payload,
    ) async {};

    voIPKit.onDidRejectIncomingCall = (
      String uuid,
      String callerId,
    ) {};

    voIPKit.onDidAcceptIncomingCall = (
      String uuid,
      String callerId,
    ) {};
  }

  void _showRequestAuthLocalNotification() async {
    await voIPKit.requestAuthLocalNotification();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: FutureBuilder<String>(
          future: voIPKit.getVoIPToken(),
          builder: (context, snapshot) {
            if (!snapshot.hasData) {
              return Text("No data");
            } else {
              return Text(snapshot.data);
            }
          },
        ),
      ),
    );
  }
}

It always returns no data

But if I run the original example if it returns the token

Bavon101 commented 3 years ago
> Can you please share your code snippet where you're calling the token function?

import 'package:flutter/material.dart';
import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart';

class CallPage extends StatefulWidget {
  CallPage({Key key}) : super(key: key);

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

class _CallPageState extends State<CallPage> {
  final voIPKit = FlutterIOSVoIPKit.instance;

  @override
  void initState() {
    super.initState();
    _showRequestAuthLocalNotification();

    voIPKit.onDidReceiveIncomingPush = (
      Map<String, dynamic> payload,
    ) async {};

    voIPKit.onDidRejectIncomingCall = (
      String uuid,
      String callerId,
    ) {};

    voIPKit.onDidAcceptIncomingCall = (
      String uuid,
      String callerId,
    ) {};
  }

  void _showRequestAuthLocalNotification() async {
    await voIPKit.requestAuthLocalNotification();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: FutureBuilder<String>(
          future: voIPKit.getVoIPToken(),
          builder: (context, snapshot) {
            if (!snapshot.hasData) {
              return Text("No data");
            } else {
              return Text(snapshot.data);
            }
          },
        ),
      ),
    );
  }
}

It always returns no data

But if I run the original example if it returns the token

it seems your code is okay from what I can see, I'll re-open the issue till there's a fix. I'll get back when I get a possible solution, if you find one please share the solution.

ntorres0612 commented 3 years ago

the

Hello, it already worked for me. I had not added Push Notifications in Signing Capabilities thank you very much @Bavon101

Bavon101 commented 3 years ago

the

Hello, it already worked for me. I had not added Push Notifications in Signing Capabilities thank you very much @Bavon101

cool

zionnite commented 2 years ago

Hello all, I get my head around these things, I have a few questions 1) Do I need to use this code voIPKit.getVoIPToken() in order to make a request to APNs 2) is Device token same as VoIP token?