Util.m
上传用户:xy800802
上传日期:2020-12-29
资源大小:194k
文件大小:1k
- #import "Util.h"
- @implementation Util
- +(void)SetBadge:(NSString*)badgeText
- {
- if(badgeText!=nil)
- {
- [ UIApp setApplicationBadge: badgeText ];
- }
- }
- +(void)RemoveBadge
- {
- [ UIApp removeApplicationBadge ];
- }
- +(int)RestartSpringboard
- {
- pid_t child = fork();
- if(child == 0){
- execlp("/bin/launchctl","launchctl","stop","com.apple.SpringBoard",NULL);
- sleep(1);
- exit(1);
- }
- return 0;
- }
- +(int)GetRandNum
- {
- srand(time(0));
- return rand();
- }
- +(NSString*)GetNSString:(char *)cstring
- {
- return [[NSString alloc] initWithCString:cstring];
- }
- @end