This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func stopSession() { | |
if let reader = reader { | |
reader.invalidate() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
let reader = NFCNDEFReaderSession.init(delegate: self, queue: nil, invalidateAfterFirstRead: false) //1 | |
reader.begin() //2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { | |
print(error.localizedDescription) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) { | |
for message in messages { | |
for record in message.records { | |
print("Record Type Id \(record.typeNameFormat)") | |
print("Record Type \(record.type)") | |
print("Record Payload \(record.payload)") | |
print("Record Identifier \(record.identifier)") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import arek | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let config = ArekConfiguration(frequency: .JustOnce, presentInitialPopup: true, presentReEnablePopup: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://github.com/gottfrois/doorkeeper-provider-app | |
curl -i http://localhost:5100/oauth/token -F grant_type="password" -F username="john.smith@myapp.com" -F password="please" -F client_id="5c13e1fdd1007229121176ec372e5d9cda2698f37f243a3965c1176bce1ecd01" -F client_secret="," | |
*/ | |
NSString *kClientID = @"5c13e1fdd1007229121176ec372e5d9cda2698f37f243a3965c1176bce1ecd01"; | |
NSString *kClientSecret = @"40dfdc7edad96c219a8c948c228eda262a561774be74b8fc0996d9e57f62b771"; | |
NSURL *baseURL = [NSURL URLWithString:@"http://localhost:5100"]; | |
AFOAuth2Manager *OAuth2Manager = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)advertise | |
{ | |
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:kSomeUUID major:1 minor:1 identifier:kSomeId]; | |
NSDictionary *beaconPeripheralData = [region peripheralDataWithMeasuredPower:nil]; | |
[self.peripheralManager startAdvertising:beaconPeripheralData]; | |
NSLog(@"Advertising on for the region: %@.", region); | |
} |