Closed dokind closed 11 months ago
@dokind can you please share the error details? Any console logs? Are you using the cameraKit staging or production environment? In case of production, the snap app must be approved and live in production. Also, make sure you have also set up the platform identifiers for both iOS and Android.
It's working in staging but not working in prod So My app didn't deployed yet. So I have to use prod token after I deploy my app in appstore ?
It does not require the app to be deployed on the app store but it should be approved in the Snapchat developer portal. Please read here how to set up production and staging environments. You must have a version approved in production as well.
Describe the bug App Crashed when I press OpenCameraKit
Expected behavior Launch CameraKit
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.
`import 'package:camerakit_flutter/camerakit_flutter.dart'; import 'package:camerakit_flutter/configuration_camerakit.dart'; import 'package:camerakit_flutter/lens_model.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hyborg/src/camera_screen/snap_const.dart';
import 'lens_list_view.dart'; import 'media_result_widget.dart';
class CameraDemeScreen extends StatefulWidget { const CameraDemeScreen({super.key});
@override State createState() => _CameraDemeScreenState();
}
class _CameraDemeScreenState extends State
implements CameraKitFlutterEvents {
/// There will be interface that we will implement on [_CameraDemeScreenState] class in the future,
/// right now we have no method to show override any function
late String _filePath = '';
late String _fileType = '';
late List lensList = [];
late final _cameraKitFlutterImpl =
CameraKitFlutterImpl(cameraKitFlutterEvents: this);
bool isLensListPressed = false;
@override void initState() { super.initState(); final config = Configuration( SnapConstants.cameraKitApiToken, SnapConstants.groupIdList, SnapConstants.cameraKitLensId, ); _cameraKitFlutterImpl.setCredentials(config); }
// Platform messages are asynchronous, so we initialize in an async method. Future initCameraKit() async {
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
await _cameraKitFlutterImpl.openCameraKit();
// await _cameraKitFlutterImpl.getGroupLenses(SnapConstants.groupIdList);
} on PlatformException {
if (kDebugMode) {
print("Failed to open camera kit");
}
}
}
// Platform messages are asynchronous, so we initialize in an async method. getGroupLenses() async { // Platform messages may fail, so we use a try/catch PlatformException. // We also handle the message potentially returning null. try { _cameraKitFlutterImpl.getGroupLenses(SnapConstants.groupIdList); } on PlatformException { if (kDebugMode) { print("Failed to open camera kit"); } } }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Camera Kit'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ ElevatedButton( onPressed: () { isLensListPressed = true; setState(() {}); getGroupLenses(); }, child: const Text("Show Lens List")), ElevatedButton( onPressed: () { initCameraKit(); }, child: const Text("Open CameraKit")), isLensListPressed ? const CircularProgressIndicator() : Container() ], ), ), ); }
@override void onCameraKitResult(Map<dynamic, dynamic> result) { setState(() { _filePath = result["path"] as String; _fileType = result["type"] as String;
}
@override void receivedLenses(List lensList) async {
isLensListPressed = false;
setState(() {});
await Navigator.of(context).push(MaterialPageRoute(
builder: (context) => LensListView(lensList: lensList)));
}
}
`