Arshad Parwez
Arshad Parwez

Reputation: 1563

How to implement NFC (Near Field Communication) in iPhone?

I am looking forward to implement NFC in iPhone. Can anyone share some sample codes for its implementation? Till now I know that one needs an adapter to implement this on iPhone while this feature has already been deployed successfully on android phones. Here is what I've found about the adapter used http://www.icarte.ca/ and http://www.nexperts.com/typo/index.php?id=51

Upvotes: 5

Views: 17312

Answers (3)

Moin Shirazi
Moin Shirazi

Reputation: 4425

Apple at WWDC 2017 introduced Core NFC, a new iOS 11 framework that enables apps to detect Near Field Communication tags.

Now detect NFC tags and read messages that contain NDEF data.

Your app can read tags to give users more information about their physical environment and the real-world objects in it. For example, your app might give users information about products they find in a store or exhibits they visit in a museum.

Note :Reading NFC NDEF tags is supported on iPhone 7 and iPhone 7 Plus.

Using Core NFC, you can read Near Field Communication (NFC) tags of types 1 through 5 that contain data in the NFC Data Exchange Format (NDEF). To read a tag, your app creates an NFC NDEF reader session and provides a delegate. A running reader session polls for NFC tags and calls the delegate when it finds tags that contain NDEF messages, passing the messages to the delegate. The delegate can read the messages and handle conditions that can cause a session to become invalid.

To enable your app to detect NFC tags, turn on the Near Field Communication Tag Reading capability in your Xcode project.

Document link : https://developer.apple.com/documentation/corenfc

Demo Project : https://github.com/hansemannn/iOS11-NFC-Example

Upvotes: 1

Fnord Prefect
Fnord Prefect

Reputation: 29

NFC seems to provide be better security for e-payment and contact solutions requiring privacy (ex: media exchange, like the new samsung galaxy s3 features) over bluetooth for two reasons:

1) the 802.11 bluetooth protocol specifies a range averaging 14 feet in diameter which is way too large to be standing at a checkout line, and someone being able to sniff or grab the signal, which is less possible on nfc, since the shorter range (a couple centimeters) and:

2) the NFC connection is made through magnetic coupling, creating the electronic field between the devices themselves, only when both devices are very close and your mfc apps are turn on/ready. bluetooth signals are their own small broadcasting antennae and it is therfore more code admin to create small network firewindows & firewalls (whitelists or blacklists) (pairing) based on IPv6 or even more of headache, ipv4.

Upvotes: 2

Srikar Appalaraju
Srikar Appalaraju

Reputation: 73638

If the proximity requirement is of the order of few centimeters then NFCis a good choice. NFC is still a new technology being adopted in Mobile phones so current install base is limited.

If the proximity requirement is of the order of few feet, then the best choice is Bluetooth. Bluetooth is available in a large number of devices. Bluetooth has the initial inquiry/discovery process which is a beaconing process to discover nearby devices in vicinity to connect to, with this is is possible to implement and detect proximity of devices.

On android this is fully supported and can be implemented easily. With iPhone Bluetooth public APIs are limited to only Gamekit, Gamekit uses internal automatic mechanism to detect devices in proximity running the same applications. Depending on your usage requirements it may be possible to do what you are thinking using the iPhone Bluetooth GameKit Apis.

iPhone also has MFi program allowing use of Blueototh to develop accessories using Bluetooth and will have more detailed access into the iPhone Blueooth capabilities/apis , to use this you need to part of the Apple MFi program to get access. See here for MFi details

Upvotes: 2

Related Questions