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 2 02-10-2010 04:31 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 09:13 PM.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407