capawesome-team / capacitor-nfc

⚡️ Capacitor plugin for reading and writing NFC tags.
https://capawesome.io/plugins/nfc/
MIT License
72 stars 14 forks source link

bug: #22

Closed marcusrong closed 1 year ago

marcusrong commented 1 year ago

Plugin version:

"@capawesome-team/capacitor-nfc": "^5.0.2",

Platform(s):

ios

Current behavior:

Capacitor says nfc is not supported.

Expected behavior:

Nfc is supported = true

Steps to reproduce:

install plugin try to initianlyse and fail


this is a quasar app.

Related code:

nfcpage.vue:

import { Nfc, NfcUtils, NfcTag } from '@capawesome-team/capacitor-nfc';

let nfcInstantiated = async () => {
      let { isSupported } = await Nfc.isSupported();
      this.nfcIsSupported = isSupported;
      if (!isSupported) {
        return;
      }
      this.rippleinterval = setInterval(() => {
        if (this.$refs['ripple'] && this.nfcIsSupported != false) {
          (this.$refs['ripple'] as Element).classList.toggle('ripple');
        } else {
          clearInterval(this.rippleinterval);
        }
      }, 800);
      let count = 0;
      Notify.create('bools ' + this.isAdmin + ' ' + this.scanning);
      while (this.isAdmin && this.scanning) {
        count++;
        Notify.create('started to listen' + count);
        await Nfc.removeAllListeners();
        await startReadWrite();
        await new Promise<void>((resolve) => {
          setTimeout(() => {
            resolve();
          }, 2000);
        });
        Notify.create('done to listen' + count);
      }
    };
    nfcInstantiated();

info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>UIApplicationSceneManifest</key>
    <dict>
        <key>UIApplicationSupportsMultipleScenes</key>
        <false/>
        <key>UISceneConfigurations</key>
        <dict/>
    </dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Quasar App</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>NDEF</string>
    <string>TAG</string>
</array>
    <key>UILaunchStoryboardName</key>

    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>NFCReaderUsageDescription</key>
    <string>The app enables the reading and writing of various NFC tags.</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
    <key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
    <array>
        <string>0003</string>
    </array>
    <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
        <string>D2760000850100</string>
        <string>D2760000850101</string>
    </array>
</dict>
</plist>

Other information:

⚡️ To Native -> Nfc isSupported 94429216 2023-06-27 01:35:39.871884+0200 App[1778:318741] [CoreNFC] -[NFCHardwareManager areFeaturesSupported:outError:]:166 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.} 2023-06-27 01:35:39.974324+0200 App[1778:318741] [CoreNFC] -[NFCHardwareManager areFeaturesSupported:outError:]:166 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.} 2023-06-27 01:35:40.179973+0200 App[1778:318741] [CoreNFC] -[NFCHardwareManager areFeaturesSupported:outError:]:166 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.} 2023-06-27 01:35:40.485304+0200 App[1778:318741] [CoreNFC] -[NFCHardwareManager areFeaturesSupported:outError:]:166 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.} 2023-06-27 01:35:40.886460+0200 App[1778:318741] [CoreNFC] -[NFCHardwareManager areFeaturesSupported:outError:]:166 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.} ⚡️ TO JS {"isSupported":false}

Screenshot 2023-06-27 at 01 52 54

Capacitor doctor:

❯ npx cap doctor
[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted.
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.0.5
  @capacitor/core: 5.0.5
  @capacitor/android: 5.0.5
  @capacitor/ios: 5.0.5

Installed Dependencies:

  @capacitor/cli: 5.0.2
  @capacitor/core: 5.0.2
  @capacitor/android: 5.0.2
  @capacitor/ios: 5.0.4

[success] iOS looking great! 👌
[error] Missing <manifest package=""> attribute in app/src/main
robingenz commented 1 year ago

Thank you for your request!

Which device do you use?

Edit: iOS Simulator is not supported.

marcusrong commented 1 year ago

Tested on my personal iPhone (14 pro max) It works on android but not iOS

robingenz commented 1 year ago

The value that is returned comes directly from NFCTagReaderSession.readingAvailable (see docs). Unfortunately there is nothing I can do/fix there. So it should be a configuration problem. Maybe this helps you: https://stackoverflow.com/a/54109822/6731412

github-actions[bot] commented 1 year ago

It looks like there hasn't been a reply in 30 days, so I'm closing this issue.