Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSString *)machine
- {
- static NSString *machine = nil;
- // we keep name around (its like 10 bytes....) forever to stop lots of little mallocs;
- if(machine == nil)
- {
- char * name = nil;
- size_t size;
- // Set 'oldp' parameter to NULL to get the size of the data
- // returned so we can allocate appropriate amount of space
- sysctlbyname("hw.machine", NULL, &size, NULL, 0);
- // Allocate the space to store name
- name = malloc(size);
- // Get the platform name
- sysctlbyname("hw.machine", name, &size, NULL, 0);
- // Place name into a string
- machine = [[NSString stringWithUTF8String:name] retain];
- // Done with this
- free(name);
- }
- return machine;
- }
- -(BOOL)hasVibration
- {
- NSString * machine = [self machine];
- if([[machine uppercaseString] rangeOfString:@"IPHONE"].location != NSNotFound)
- {
- return YES;
- }
- return NO;
- }
- AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
- AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
Add Comment
Please, Sign In to add comment