chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

nfc.beginSession not opening the dialogue over the app #283

Closed andyj closed 6 years ago

andyj commented 6 years ago

First question: Does anyone have this working at all?

My issue: I've created a blank PhoneGap app with a single button on the page

<button id="iosNfcButton" href="##">ios nfc</button>

I have a listener

document.getElementById('swipeTag').addEventListener("click",iosNFC,false);

And a function

function iosNFC(){
  nfc.beginSession(
    function(){console.log("Success");},
    function(){console.log("ERROR");}
  );
}

When the button is clicked it appears that it doesn't work. What is actually happening is that the "Ready To Scan" box isn't coming up over the app and taking focus. The way I found out it was there (by accident) was to double click the home button to switch away and then it takes focus. At that point the swipe works and return back to the app.

Is this an iOS issue, plugin issue or phone app problem?

If anyone has it working could they share what their repo?

don commented 6 years ago

@andyj are you still seeing this? What version of iOS are you using?

Can you share a project on GitHub so I can try to duplicate on my hardware?

andyj commented 6 years ago

Version 11.0.1 (15A403) iPhone 8+ ( if that changes anything?)

don commented 6 years ago

I was hoping 11.0.1 might have fixed the issue. Can you share a simple project? I haven't been able to duplicate this.

andyj commented 6 years ago

I've just created https://github.com/andyj/iosnfc

JohnMcLear commented 6 years ago

I don't experience this bug, weird one.. If you create the project with cordova do you get the same experience?

I tested on iPhone 7 & 8. Not sure on version.

andyj commented 6 years ago

I’ll try Cordova tonight. My only thought is that an Xcode setting is affecting it?

andyj commented 6 years ago

@JohnMcLear thank you for pointing me at Cordova. Works fine. The problem then is Phonegap, my installed version is up to date with the current releases too.

JohnMcLear commented 6 years ago

Pleasure.


From: Andy Jarrett notifications@github.com Sent: 3 Oct 2017 10:16 pm To: chariotsolutions/phonegap-nfc Cc: John McLear; Mention Subject: Re: [chariotsolutions/phonegap-nfc] nfc.beginSession not opening the dialogue over the app (#283)

@JohnMcLearhttps://github.com/johnmclear thank you for pointing me at Cordova. Works fine. The problem then is Phonegap, my installed version is up to date with the current releaseshttps://build.phonegap.com/current-support too.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/chariotsolutions/phonegap-nfc/issues/283#issuecomment-333981068, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AANewIpCcouXKMXU3ZNHhvShnC8tBcZ1ks5soqQVgaJpZM4Plzb5.

JoshuaPerk commented 6 years ago

@andyj I seem to be having an issue that appears to be rooted in the same vein. I took your repo and added platform ios in cordova, then built, and ran it on my device via xcode. I hit the button and nothing seems to happen (other than the "NFC button hit" text). I had to add a few Capabilities in order to compile, but I'm not quite sure what I'm missing... (iPhone 7).

JoshuaPerk commented 6 years ago

@andyj I was in-fact able to get it sort-of working. Running into the same issue though. Doesn't pop up until I double click the home button... No idea why...

JoshuaPerk commented 6 years ago

@don @JohnMcLear, are you aware of any xCode settings or quarks with NFC Core or the plugin implementation that would be causing the following? I've rebuilt in the most recent Cordova and PhoneGap to no avail.

https://youtu.be/LwilT02EFxg

@andyj, I'm assuming the above is what you experienced?

JohnMcLear commented 6 years ago

I don't, sorry! I'd offer to try build for you but I'm not at my iOS build environment for another month or so.

JoshuaPerk commented 6 years ago

I greatly appreciate the notion; no worries! I believe the issue was (oddly enough) tied directly to the CSP tag. My CSP settings were preventing the dialogue modal from appearing. When I exited the app (and my CSP rules were no longer in place), the modal executed.

Happy New Year!