Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 17, 2011, 08:33 PM   #1
GhostDZ9
macrumors regular
 
Join Date: Sep 2010
Local Push Notifications

Hi Guys,

I have read the documentation on developer.apple.com about the push notifications however I still can seem to get it right, is there someone I can talk to who can guide me on how to build local push notifications for my app?

Regards,

Ghost
__________________
- 30 GB iPod Video - Black
- 13.3" MB - 4GB RAM - 500GB 7200RPM HDD
- 16 GB iPhone 4 - Black
- Game Center Tag: GhostDZ9
GhostDZ9 is offline   0 Reply With Quote
Old May 17, 2011, 10:08 PM   #2
aaronbrethorst
macrumors member
 
Join Date: Feb 2007
Location: Seattle, WA
 
see vendor information in user profile
Quote:
Originally Posted by GhostDZ9 View Post
Hi Guys,

I have read the documentation on developer.apple.com about the push notifications however I still can seem to get it right, is there someone I can talk to who can guide me on how to build local push notifications for my app?

Regards,

Ghost
Local *push* notifications? You mean local notifications? Sure, here ya go:

Code:
UILocalNotification* note = [[UILocalNotification alloc] init];
note.fireDate = [NSDate date];
note.timeZone = [NSTimeZone defaultTimeZone];
note.repeatInterval = NSDayCalendarUnit;
note.alertBody = NSLocalizedString(@"It's a notification!",@"");
note.alertAction = NSLocalizedString(@"Hi there",@"");
[[UIApplication sharedApplication] scheduleLocalNotification:note];
[note release];
__________________
Aaron Brethorst - iOS and Rails developer, proprietor of Cocoa Controls
Sandy Bridge MBP 2.3 / mid 2010 iMac / iPhones / iPads
aaronbrethorst is offline   0 Reply With Quote
Old May 18, 2011, 03:06 AM   #3
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
appdelegate =

Code:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    NSLog(@"This was fired off");
}
viewDidload

Code:
UIApplication *app                = [UIApplication sharedApplication];
    UILocalNotification *notification = [[UILocalNotification alloc] init];
    NSArray *oldNotifications         = [app scheduledLocalNotifications];
    
    if ([oldNotifications count] > 0) {
        [app cancelAllLocalNotifications];
    }
    
    if (notification == nil)
        return;
    
    NSDate *notificationDate = [NSDate dateWithTimeIntervalSinceNow:10];
    
    notification.fireDate  = notificationDate;
    notification.timeZone  = [NSTimeZone systemTimeZone];
    notification.alertBody = @"Woop example";
    
    [app scheduleLocalNotification:notification];
    
    [notification release];
If the viewDidload is called, minus ur app, and wait 10 secs gl
jnoxx is offline   0 Reply With Quote
Old May 18, 2011, 08:10 AM   #4
GhostDZ9
Thread Starter
macrumors regular
 
Join Date: Sep 2010
Great thanks guys, Ill try these out now, do you guys know if alerts work outside the app when it isn't launched?
__________________
- 30 GB iPod Video - Black
- 13.3" MB - 4GB RAM - 500GB 7200RPM HDD
- 16 GB iPhone 4 - Black
- Game Center Tag: GhostDZ9
GhostDZ9 is offline   0 Reply With Quote
Old May 18, 2011, 08:13 AM   #5
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
Afaik, u need the push notifications from Apple then, which is something totally different.. Sorry, no experience with that.
jnoxx is offline   0 Reply With Quote
Old May 18, 2011, 08:16 AM   #6
GhostDZ9
Thread Starter
macrumors regular
 
Join Date: Sep 2010
Well I want to have it so when the user sets a time for when they have to be back it shows a notification with the notes that they have entered in, how can i customize the code that you have given me?
__________________
- 30 GB iPod Video - Black
- 13.3" MB - 4GB RAM - 500GB 7200RPM HDD
- 16 GB iPhone 4 - Black
- Game Center Tag: GhostDZ9
GhostDZ9 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How to edit push notifications? Please help! ryanstewart iOS 5 and earlier 13 Apr 2, 2012 01:20 PM
Please Help, Push Notifications Not Working RonYosafi Jailbreaks and iOS Hacks 6 Apr 21, 2011 03:14 PM
Ad Hoc build not registering for push notifications SimonBS iPhone/iPad Programming 0 Mar 21, 2011 03:53 PM
POLL: Lion Push Notification tourada Mac OS X 10.7 Lion 4 Mar 20, 2011 08:53 AM
Easy Reminders - Local push notifications with Snooze arytbk iPhone and iPod touch Apps 0 Nov 1, 2010 09:44 AM


All times are GMT -5. The time now is 03:52 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC