Created
March 7, 2014 15:29
-
-
Save davidgyoung/9413548 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Two classes: | |
// IBeaconSimulator | |
// SimulatedBeacon | |
IBeaconSimulator *CLBeaconSimulator [[IBeaconSimulator alloc] initWithLocationManger: locationManager]; | |
[iBeaconSimulator addVisibleIBeacon: [[SimulatedBeacon] alloc] initWithUUID: @"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6" major: 1 minor: 1 accuracy: 2.0]]; | |
// an alternative to the above for more complex testing. This could alternatively set a delegate method | |
[iBeaconSimulator visibleIBeaconBlock: ^{ | |
NSMutableArray *visibleIBeacons = [[NSMutableArray alloc] init]; | |
SimulatedBeacon *iBeacon = [[SimulatedBeacon] alloc] initWithUUID: @"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6" major: 1 minor: 1 accuracy: 2.0]; | |
[visibleIBeacons add: iBeacon]; | |
return visibleIBeacons; | |
}]; | |
[iBeaconSimulator start]; // calls callback methods on locationManager at 1Hz | |
[iBeaconSimulator stop]; // stops the above | |
[iBeaconSimulator fireCallbacks]; // calls methods on locationManager once (for unit testing) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment