Open Andre-Coelhoo opened 1 year ago
Hello everyone im having an issue, I get the default animation of the iOS to read the nfc but when I approach a tag at the phone nothing happens.
class NfcEnableWidget extends StatefulWidget { final BuildContext contextParent; const NfcEnableWidget({Key? key, required this.contextParent}) : super(key: key); @override _NfcEnableWidgetState createState() => _NfcEnableWidgetState(); } class _NfcEnableWidgetState extends State<NfcEnableWidget> { @override void initState() { super.initState(); NfcManager.instance.startSession( // Here. NOTE: all options are specified by default. pollingOptions: {NfcPollingOption.iso14443, NfcPollingOption.iso15693}, onDiscovered: (tag) async { // Do something with the valid tag data final result = await widget.contextParent .read<TagOnBoardingCubit>() .checkNfcCode(tag); if (result != null) { ScaffoldMessenger.of(widget.contextParent).showSnackBar( SnackBar( content: Text(result), ), ); } }, ); } @override void dispose() { NfcManager.instance.stopSession().catchError((_) {}); super.dispose(); } @override Widget build(BuildContext context) { return Stack( alignment: Alignment.center, children: [ Center( child: Container( width: MediaQuery.of(context).size.width * 0.9, height: 300, padding: EdgeInsets.all(12), child: Column(children: [ Padding(padding: EdgeInsets.only(top: 50)), Text( 'Ready to scan', style: TextStyle( fontFamily: 'PlusJakartaSans', fontSize: 28, fontWeight: FontWeight.w500, color: Colors.white), ), Padding(padding: EdgeInsets.only(top: 35)), tagOnBoardingContactlessReadyAsset ]))), Positioned( left: MediaQuery.of(context).size.width * 0.05, top: MediaQuery.of(context).size.height * 0.1, child: IconButton( padding: EdgeInsets.zero, constraints: BoxConstraints(), icon: const Icon(Icons.close, color: Colors.white), onPressed: () => Navigator.of(context).pop(), ), ), Positioned( top: MediaQuery.of(context).size.height * 0.1, child: Row( children: [ Text( S.of(context).nfc.toUpperCase(), style: tagOnBoardingBoldText.copyWith(color: Colors.white), ), ], ), ), Positioned( top: MediaQuery.of(context).size.height * 0.16, child: Row( children: [ /// Scan button InkWell( onTap: () => BlocProvider.of<TagOnBoardingCubit>(context).changeToScan(), child: Container( padding: EdgeInsets.all(8), child: Column( children: [ tagOnBoardingQrCodeAssetWhite, SizedBox(height: 8), Text( S.of(context).scan.toUpperCase(), style: tagOnBoardingSmallText.copyWith( color: Colors.white), ), ], ), ), ), SizedBox(width: MediaQuery.of(context).size.height * 0.05), /// Nfc Button Container( padding: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6)), color: secondaryTextColor, ), child: Column( children: [ tagOnBoardingContactlessAsset, SizedBox(height: 8), Text( S.of(context).nfc.toUpperCase(), style: tagOnBoardingSmallText.copyWith(color: Colors.white), ), ], ), ), SizedBox(width: MediaQuery.of(context).size.height * 0.05), /// Type button InkWell( onTap: () => BlocProvider.of<TagOnBoardingCubit>(context).changeToType(), child: Container( padding: EdgeInsets.all(8), child: Column( children: [ tagOnBoardingNumPadAsset, SizedBox(height: 8), Text( S.of(context).type.toUpperCase(), style: tagOnBoardingSmallText.copyWith( color: Colors.white), ), ], ), ), ), ], ), ), ], ); } }
<string>This app uses the NFC to read the tags.</string>
<array> <string>D2760000850101</string> </array> <key>com.apple.developer.nfc.readersession.felica.systemcodes</key> <array> <string>12FC</string> </array> <key>com.apple.developer.nfc.readersession.formats</key> <array> <string>TAG</string> <string>NDEF</string> </array>
Maybe your iPhone or iOS doesn't support NFC.
Hello everyone im having an issue, I get the default animation of the iOS to read the nfc but when I approach a tag at the phone nothing happens.