How to implement NFC in an iPhone app? - ios

So I was wondering if anyone knows how I can implement NFC usage into my app. The result I want by using NFC is when someone passes an NFC sensor with their phones in their pocket for example, the action triggers a notification for example but I do not know how to add NFC to the app and how the NFC necessarily interacts with in the iOS system. Also, is the code for NFC implementation available in Swift yet or is it only in Objective C so far? Thanks a lot in advance! Thanks a lot in advance!

NFC is a very new thing for Apple, having only just added the chip to their new phones, 6 and 6 Plus. Unfortunately for you, they have made a decision to add not functionality at all in Xcode, and they have restricted NFC usage to Apple Pay only. That means trying to code a pairing system to Bluetooth speakers or a Touch ID-enabled way of exchanging contacts, URLs, and photos with a tap won’t work. However, Apple might in the future allow developing for NFC like they did with the Touch ID sensor in iOS 8. Unfortunately, for now, you won't be able to code for NFC.
Sorry to be the bearer of bad news,
Will

If you look past NFC you could get the exact functionality your looking for with iBeacon.

Related

NFC data transfer on iPhones

Is it possible to transfer data between two iPhones using NFC? I'm working on an app that aims to exchange specific strings between two phones and would preferably use NFC. (If so, would it work for iPhone - Android connection?)
The Answer is NO.
So far apple has only allowed to read data. We cannot send any data between two iPhones or between an iPhone and a Android Device.
iOS11 seems to offer the potential to read NFC data so one-way traffic between Android and iOS appears possible.

iPhone NFC and QR possibility

We are developing a game what is based on our engine. The concept of the engine is to read NFC and QR codes, launch our application, and send a request to our server, what is respond to the application. It's done on android.
We want to port this engine to iOs and Windows also. So our plan is to hire developers for this project. Before 4-5 month, we surprised, iPhone does not supports NFC, they will use iBeacon, but we was very happy, when we realized, iPhone 6 will have NFC reader. And then, after I made some research on the net, I was so sad, because I read everywhere, apples NFC is restricted the NFC to Apple Pay.
Because i really do not know apple devices, i have some questions.
Is it possible to do this with iOs? If NFC is not an option, can we do this with QR reader? If no, of course we won't hiring developers for iOs.
And i know, this is a stupid question, but maybe: does anybody know, what is apples plan in the future with NFC?
You can implement QR reader function in iOS app using C++ libraries: ZXing and ZBar. Personally I recomment you to use ZBar, it is better for QR codes but cannot read bar codes.
You can use iBeacons with iOS.
Apple's Passbook application works through optical scanning of QR codes.

Reading NFC Tags with iPhone 6 / iOS 8

Now that Apple just announced the iPhone 6 will have an NFC chip, does anyone know if iOS 8 will enable reading/detecting RFID tags for the iPhone 6 device? Anyone have any details to share on this?
The iPhone6/6s/6+ are NOT designed to read passive NFC tags (aka Discovery Mode). There's a lot of misinformation on this topic, so I thought to provide some tangible info for developers to consider. The lack of NFC tag read support is not because of software but because of hardware. To understand why, you need to understand how NFC works. NFC works by way of Load Modulation. That means that the interrogator (PCD) emits a carrier magnetic field that energizes the passive target (PICC). With the potential generated by this carrier field, the target then is able to demodulate data coming from the interrogator and respond by modulating data over top of this very same field. The key here is that the target never creates a field of its own.
If you look at the iPhone6 teardown and parts list you will see the presence of a very small NFC loop antenna as well as the use of the AS3923 booster IC. This design was intended for custom microSD or SIM cards to enable mobile phones of old to do payments. This is the type of application where the mobile phone presents a Card Emulated credential to a high power contactless POS terminal. The POS terminal acts as the reader, energizing the iPhone6 with help from the AS3923 chip. The AS3923 block diagram clearly shows how the RX and TX modulation is boosted from a signal presented by a reader device. In other words the iPhone6 is not meant to provide a field, only to react to one. That's why it's design is only meant for NFC Card Emulation and perhaps Peer-2-Peer, but definitely not tag Discovery.
There are some alternatives to achieving tag Discovery with an iPhone6 using HW accessories. I talk about these integrations and how developers can architect solutions in this blog post. Our low power reader designs open interesting opportunities for mobile engagement that few developers are thinking about.
Disclosure: I'm the founder of Flomio, Inc., a TechStars company that delivers proximity ID hardware, software, and services for applications ranging from access control to payments.
Update: This rumor, if true, would open up the possibility for the iPhone to practically support NFC tag Discovery mode. An all glass design would not interfere with the NFC antenna as does the metal back of the current iPhone. We've attempted this design approach --albeit with cheaper materials-- on some of our custom reader designs with success so looking forward to this improvement.
Update: iOS11 has announced support for "NFC reader mode" for iPhone7/7+. Details here. API only supports reading NDEF messages (no ISO7816 APDUs) while an app is in the foreground (no background detection). Due out in the Fall, 2017... check the screenshot from WWDC keynote:
From digging into the iOS 8 docs that are available as of Sept 9th 3:30pm there is no mention of developer access to the NFC controller to perform any NFC operations; that includes reading tags, writing tags, pairing, payments, tag emulation... Given its an NXP controller the hardware has the capability to perform these features. They did mention a 3rd party app for the watch that allowed a hotel guest to open their room door with NFC. This is a classic use case for NFC and gives some indication that the NFC controller will be open to developers at some point. Remember, the watch is not supposed to be released until Q1 2015. So for now I'd say it's closed but will be open soon. Given the 'newness' of contactless payments for the general US consumer and the recent security breaches its not surprising Apple wants to keep this closed for a while.
Disclosure: Im the CEO of GoToTags, an NFC company with obvious vested interest in Apple opening up NFC to developers.
--- Correction & Update ---
The hotel app actually uses Bluetooth, not NFC. NFC is still often used for door unlocking, just not in this one example. NFC could be used if the watch has an open NFC controller.
I do know that Apple is aware of all of this and is discussing this with their top developers and stakeholders. There has already been massive negative push back on the lack of support for reading tags. As often the case in the past, I expect Apple to eventually open this up to developers for non-payment related functionality (reading tags, pairing). I do not think Apple will ever allow other wallets though. File sharing will likely be left to AirDrop as well.
--- Update on March 23rd 2016 ---
I am continually asked for updates about this topic, often with people referencing this post. With Apple releasing the iPhone SE, many are again asking why Apple has not supported tag reading yet. In summary Apple is more focused on Apple Pay succeeding than the other use cases for NFC for now. Apple could make a lot of money from Apple Pay, and has less to make from the other uses for NFC. Apple will likely open up NFC tag reading when they feel that consumer trust and security with NFC and Apple Pay is such that it wont put Apple Pay at risk. Further information here.
--- Update on May 24th 2017 ---
A developer in Greece has hacked the iPhone 6s to get it to read NFC tags via the NFC private frameworks; more info & video. While this isn't a long term solution, it provides some guidance on some outstanding question: Is there enough power in the iPhone's NFC controller to power an NFC tag? Looks like the answer is yes. From initial testing the range is a few cm, which isn't too bad. It might also be the power is tunable; this is being investigated at this time. The implications of this are significant. If the older model phones do have enough RF power for tag reading/writing, then when Apple does open up the SDK it means there will be 100Ms of iPhones that can read NFC tags, vs the case where only the new iPhones could.
At the moment, there isn't any open access to the NFC controller. There are currently no NFC APIs in the iOS 8 GM SDK - which would indicate that the NFC capability will be restricted to Apple Pay at launch. This is our understanding.
Clearly, the NXP chip inside the iPhone 6 is likely to be able to do more so this doesn't mean that additional features (pairing, tag scanning/encoding) will not be added for release or in the near future.
At the moment, Apple has not opened any access to the embedded NFC chip to developers as suggested by many articles such as these ones :
Apple Cripples NFC in iPhone 6, 6+ With Developer Ban from Daily Tech
Apple Restricting Use of NFC Antenna in iPhone 6 and 6 Plus to Apple Pay from Mac Rumors
Apple confirms iPhone 6 NFC chip is only for Apple Pay at launch from Cult of Mac
Apple initially restricts iPhone 6, iPhone 6 Plus NFC chip to Apple Pay from Tech Times
The list goes on. The main reason seems (like lots the other hardware features added to the iPhone in the past) that Apple wants to ensure the security of such technology before releasing any API for developers to let them do whatever they want. So at first, they will use it internally for their needs only (such as Apple Pay at launch time).
"At the moment, there isn't any open access to the NFC controller,"
said RapidNFC, a provider of NFC tags. "There are currently no NFC
APIs in the iOS 8 GM SDK".
But eventually, I think we can all agree that they will develop such API, it's only a matter of time.
The ability to read an NFC tag has been added to iOS 11 which only support iPhone 7 and 7 plus
As a test drive I made this repo
First: We need to initiate NFCNDEFReaderSession class
var session: NFCNDEFReaderSession?
session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false)
Then we need to start the session by:
session?.begin()
and when done:
session?.invalidate()
The delegate (which self should implement) has basically two functions:
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage])
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error)
here is my reference Apple docs
The only information currently available is that Apple Pay will be available in ios8, but that doesn't shed any light on whether RFID tags or rather NFC tags specifically will be able to be detected/read.
IMO it would be a shortsighted move not to allow that possibility, but really the money is in Apple Pay, not necessarily in allowing developers access to those features - we've seen it before with tethering, Bluetooth SPP, and diminished access to certain functions.
...but then again, it's been about 5 hours since the first announcement.
I think it will be sometime before we get to see access to the NFC as the pure security side of it like for example being able to walk past somebody brush past them and & get your phone to the zap the card details or simply Wave your phone over someone's wallet which They left on the desk.
I think the first step is for Apple to talk to banks and find more ways of securing cards and NFC before This will be allowed

How to find wifi/cellular signal strength in ios [duplicate]

As far as I know it's not possible to scan for hotspots in range and read their bssid and signal strengths. This was possible on iOS 4 by using private APIs and not longer possible on iOS 5 without jailbreak. Even if it were possible, the app would be rejected on the App Store. Is that right?
One company that has an indoor positioning system is claiming they can develop this system in iOS. I know for a fact they are scanning for hotspots and signal strengths and then triangulating the signal on their current Android app.
Are there any alternatives I am missing? Their claiming sounds impossible to me but I would love to hear from the people here. I would like to be ready when they demo (although I am expecting a jailbreak or some kind of mock up)
As far as i know this can still be done (using private APIs, of course) by MobileApple80211 framework.
Stumbler code is a good source of information on how to use this framework.
For iOS 5 you'll need a jailbroken iPhone. Guvener Gokce has a very educational blog post on this: iPhone Wireless Scanner iOS5
Just to update the answer: The MobileApple80211 framework has been replaced by MobileWifi.framework. You will need a jailbroken device (supposedly it can't be done using just private API's, hence on a development/enterprise non-jailbroken device).

iOS wifi scan, signal strength

As far as I know it's not possible to scan for hotspots in range and read their bssid and signal strengths. This was possible on iOS 4 by using private APIs and not longer possible on iOS 5 without jailbreak. Even if it were possible, the app would be rejected on the App Store. Is that right?
One company that has an indoor positioning system is claiming they can develop this system in iOS. I know for a fact they are scanning for hotspots and signal strengths and then triangulating the signal on their current Android app.
Are there any alternatives I am missing? Their claiming sounds impossible to me but I would love to hear from the people here. I would like to be ready when they demo (although I am expecting a jailbreak or some kind of mock up)
As far as i know this can still be done (using private APIs, of course) by MobileApple80211 framework.
Stumbler code is a good source of information on how to use this framework.
For iOS 5 you'll need a jailbroken iPhone. Guvener Gokce has a very educational blog post on this: iPhone Wireless Scanner iOS5
Just to update the answer: The MobileApple80211 framework has been replaced by MobileWifi.framework. You will need a jailbroken device (supposedly it can't be done using just private API's, hence on a development/enterprise non-jailbroken device).

Resources