Home User CP Donate Chat Register Today!  
  Get New posts Faq / Help?
   


Go Back   Hackint0sh > Projects and Hacks > iPhone > Applications & Development > iPhone Developer Exchange

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2009, 02:03 PM
TheBrew
Status: Offline
Junior Member
 
Join Date: May 2008
Posts: 15
Rep Power: 0
TheBrew is on a distinguished road
Default Background badging in OS3.0

Hi all,

The method used to badge applications from the command line (Erica Sadun style, with Dynamic Linking to the SBSSpringBoardServerPort) is no longer valid in 3.0. I'm guessing Apple changed it when adding the push-notification service.

Trying to badge an app just ends up with a "Bus Error".

And I can't use the UIApplication +setApplicationIconBadgeNumber: since it's a daemon doing the badging.

Any geniuses out there who have an idea as to what I can try? I'm out of ideas...

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-13-2009, 08:53 PM
xGrill
Status: Offline
Junior Member
 
Join Date: Nov 2008
Posts: 14
Rep Power: 0
xGrill is on a distinguished road
Default

You can try using the com.apple.springboard.displaystate.plist file, not sure if you can change any badge numbers that way.

See
Chris Alvares blog iPhone tip: Springboard Badge numbers in 3.0
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 07-18-2009, 03:46 PM
TheBrew
Status: Offline
Junior Member
 
Join Date: May 2008
Posts: 15
Rep Power: 0
TheBrew is on a distinguished road
Default

Quote:
Originally Posted by xGrill View Post
You can try using the com.apple.springboard.displaystate.plist file, not sure if you can change any badge numbers that way.
Thanks for your suggestion.

I fiddled around with that, but changing the value doesn't affect the springboard. So I figured that I might have to post a notification, to make it refresh the values from the file .. but I've been going through all the notifications and nothing does the job.

What I did find out though, was that the contents of the file is reset to the original "un-hacked" values when I receive a mail for example.. so my guess is, that the badge must be posted to an in-memory process that then updates the springboard (and the displaystate file).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #4 (permalink)  
Old 07-18-2009, 06:19 PM
TheBrew
Status: Offline
Junior Member
 
Join Date: May 2008
Posts: 15
Rep Power: 0
TheBrew is on a distinguished road
Default Background badging in OS3.0 [SOLVED]

OK.. I solved it.

Here's what you do:

Use class-dump to dump the headers for /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore

..OR go to iPhone 3.0 Headers at Erica Sadun's site to get the following 3 class headers:

ISOperation.h
ISOperationProgress.h
ISSetApplicationBadgeOperation.h

You may have to edit ISOperation.h:

1. Change the #import "NSOperation.h" to #import <Foundation/NSOperation.h>
2. Remove the "<ISOperationDelegate>" 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 <iTunesStore/ISSetApplicationBadgeOperation.h>" to your code and, for your convenience, here's an example-function ready for use:

Code:
BOOL badge(NSString *bundleIdentifier, NSInteger number)
{
	ISSetApplicationBadgeOperation *sbadge = [[ISSetApplicationBadgeOperation alloc] init];
	
	if (sbadge == nil) return FALSE;
	
	[sbadge setBundleIdentifier:bundleIdentifier];
	[sbadge setBadgeValue:[NSString stringWithFormat:@"%d",number]];
	[sbadge run];
	[sbadge release];
	return TRUE;
}
Usage: badge(@"com.yourcompany.yourapp",2);

Remove the badge by passing 0 as the number. Sadly it doesn't work with strings..

Do note, that we're using undocumented methods here, so they could change at any point ..which Apple isn't shy to tell us. Let's hope they keep it around for a while.

Cheers and happy coding

(Thanks to Steve Nygard for class-dump and Erica Sadun for being such a great source for information. Aaah, free information)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a background iPhone application that is always running UndeadCretin iPhone Developer Exchange 0 04-02-2009 12:49 PM
AppleInsider: Apple rumored allowing real background apps on iPhone hackint0sh Latest Headlines 0 02-04-2009 02:10 AM
MacNN: Background processes to show in iPhone 3.0? hackint0sh Latest Headlines 0 02-03-2009 11:00 PM
[UIWebView] Transparent background ? attodorov iPhone Developer Exchange 0 05-06-2008 04:37 PM
iPhone Main Background maccabbi General 2 07-16-2007 06:21 PM



All times are GMT +2. The time now is 03:10 AM.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 Ad Management by RedTyger
follow us on Twitter!

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105