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
// .h | |
@interface UIDevice (ProcessesAdditions) | |
- (NSArray *)runningProcesses; | |
@end | |
// .m | |
#import <sys/sysctl.h> | |
@implementation UIDevice (ProcessesAdditions) |
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)updateNowPlayingCenter:(NSDictionary *)info | |
{ | |
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.2") && SYSTEM_VERSION_LESS_THAN(@"8.3")) | |
{ | |
NSString *zeroLengthString = @"\u200B"; | |
NSString *title = info[MPMediaItemPropertyTitle]; | |
NSString *currentTitle = [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo[MPMediaItemPropertyTitle]; | |
NSUInteger index = [currentTitle rangeOfString:zeroLengthString].location; | |
if (index == NSNotFound) | |
{ |
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
+ (NSArray *)addressesForHostname:(NSString *)hostname | |
{ | |
if (!hostname) | |
{ | |
return nil; | |
} | |
// Get the addresses for the given hostname. | |
CFHostRef hostRef = CFHostCreateWithName(kCFAllocatorDefault, (__bridge CFStringRef)hostname); | |
BOOL isSuccess = CFHostStartInfoResolution(hostRef, kCFHostAddresses, nil); |
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
// | |
// ViewController.m | |
// AVPlayerCaching | |
// | |
// Created by Anurag Mishra on 5/19/14. | |
// Sample code to demonstrate how to cache a remote audio file while streaming it with AVPlayer | |
// | |
#import "ViewController.h" | |
#import <AVFoundation/AVFoundation.h> |