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
#import <XCTest/XCTest.h> | |
#import <OCMock/OCMock.h> | |
typedef void(^MockBlock)(void); | |
@interface Action : NSObject | |
@property (nonatomic, strong) MockBlock action; | |
@end |
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
#import <StoreKit/StoreKit.h> | |
typedef void(^SKRequestCompletion)(SKRequest * request, NSError * error); | |
@interface SKRequest (Blocks) <SKRequestDelegate> | |
- (void) startWithCompletion:(SKRequestCompletion) completion; | |
@end |
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
#import "SKRequest+Blocks.h" | |
#import <objc/runtime.h> | |
static char const * const completion_key = "completion"; | |
@implementation SKRequest (Blocks) | |
- (void) | |
request :(SKRequest *) request | |
didFailWithError:(NSError *) error |
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
SKRequest * arequest = ( | |
[[SKReceiptRefreshRequest alloc] | |
initWithReceiptProperties:nil | |
] | |
); | |
[arequest | |
startWithCompletion:^(SKRequest *request, NSError *error) | |
{ | |
if( error ) { |
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
struct ifaddrs *interfaces; | |
if(!getifaddrs(&interfaces)) { | |
for( struct ifaddrs *interface = interfaces; interface; interface=interface->ifa_next) { | |
BOOL up = (interface->ifa_flags & IFF_UP) == IFF_UP; | |
if ( up ) { | |
NSLog( | |
@"Name : %s, sa_family : %d", | |
interface->ifa_name, | |
interface->ifa_addr->sa_family |
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
Name : lo0, sa_family : 18 | |
Name : lo0, sa_family : 30 | |
Name : lo0, sa_family : 2 | |
Name : lo0, sa_family : 30 | |
Name : pdp_ip0, sa_family : 18 | |
Name : pdp_ip0, sa_family : 2 | |
Name : en0, sa_family : 18 | |
Name : awdl0, sa_family : 18 |
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
Name : lo0, sa_family : 18 | |
Name : lo0, sa_family : 30 | |
Name : lo0, sa_family : 2 | |
Name : lo0, sa_family : 30 | |
Name : pdp_ip0, sa_family : 18 | |
Name : pdp_ip0, sa_family : 2 | |
Name : en0, sa_family : 18 | |
Name : awdl0, sa_family : 18 | |
Name : awdl0, sa_family : 30 |
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
Name : lo0, sa_family : 18 | |
Name : lo0, sa_family : 30 | |
Name : lo0, sa_family : 2 | |
Name : lo0, sa_family : 30 | |
Name : pdp_ip0, sa_family : 18 | |
Name : pdp_ip0, sa_family : 2 | |
Name : en0, sa_family : 18 | |
Name : en0, sa_family : 30 | |
Name : en0, sa_family : 2 | |
Name : awdl0, sa_family : 18 |
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
#import <Foundation/Foundation.h> | |
#import <ifaddrs.h> | |
#import <net/if.h> | |
#import <SystemConfiguration/CaptiveNetwork.h> | |
@interface SMTWiFiStatus : NSObject | |
- (BOOL) isWiFiEnabled; | |
- (BOOL) isWiFiConnected; |
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
SMTWiFiStatus * wstatus = [SMTWiFiStatus new]; | |
NSLog(@"Wifi Enabled : %@", [wstatus isWiFiEnabled ] ? @"Yes" : @"No"); | |
NSLog(@"Wifi Connected : %@", [wstatus isWiFiConnected] ? @"Yes" : @"No"); | |
NSLog(@"Wifi BSSID : %@", [wstatus BSSID]); | |
NSLog(@"Wifi SSID : %@", [wstatus SSID ]); |