修改程序圖標標示數字

1.修改自身應用圖標標示數字:
    [UIApplication sharedApplication].applicationIconBadgeNumb er = 10;
2. 修改其餘應用圖標標示數字:
    ios7.0下的sdk
    Use  class-dump  to dump the headers for /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore

涉及的頭文件
ISOperation-ISAuthentication.h
ISOperation-ISLoadSoftwareMapAdditions.h
ISOperation-ISLoadURLBagAdditions .h
ISOperation .h
ISOperationDelegate-Protocol .h
ISOperationQueue .h
ISSetApplicationBadgeOpe ration.h

You may have to edit ISOperation.h:

1. Change the #import "NSOperation.h" to #import
2. Remove the "" in the first part of the interface. So you're just left with "id _delegate;"

Then copy these 3 files into a "Headers" dir inside of the /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/iTunesStore.framework dir.

You can now add the iTunesStore framework to your xcode project. Just point to the dir above.

Now add "#import " to your code and, for your convenience, here's an example-function ready for use:

CODE:
   
  1. ISSetApplicationBadgeOperation *sbadge = [[ISSetApplicationBadgeOperation alloc] init];
  2.     
  3.     
  4.     [sbadge setBundleIdentifier:bundleIdentifier];
  5.     [sbadge setBadgeValue:[NSString stringWithFormat:@"%d",number]];
  6.     [sbadge run];
  7.     [sbadge release];
相關文章
相關標籤/搜索