Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-10-2010, 04:16 PM   #1 (permalink)
www.Alexj17.com
 
Alexj17's Avatar
 
Join Date: May 2009
Location: Liverpool, England
Posts: 181
Alexj17 is on a distinguished road
Send a message via Skype™ to Alexj17
Default Notifications While App Open

Hey All

I have my push notifications working perfectly now. Only thing i need to know is how to have them pop-up when the app is open. They are a important part to what im doing and do require them to show even while the user is using the app. Any ideas how?

Alex
Alexj17 is offline   Reply With Quote
Old 08-10-2010, 04:21 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Code:
application:didReceiveRemoteNotification:
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-10-2010, 04:30 PM   #3 (permalink)
www.Alexj17.com
 
Alexj17's Avatar
 
Join Date: May 2009
Location: Liverpool, England
Posts: 181
Alexj17 is on a distinguished road
Send a message via Skype™ to Alexj17
Default

Quote:
Originally Posted by BrianSlick View Post
Code:
application:didReceiveRemoteNotification:
i already have this, and it shows what i want in the log, but i dont know how to get the alert etc from this to an alert - i know how to do an alert as well, its just the extraction of the data im stuck on..

Code:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
	
    for (id key in userInfo) {
        NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
		
    }    
	
}
Alexj17 is offline   Reply With Quote
Old 08-10-2010, 04:32 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Maybe peek at the documentation?

Quote:
Discussion
The delegate receives this message when the application is running and a remote notification arrives for it. In response, the application typically connects with its provider and downloads the data waiting for it. It may also process the notification in any other way it deems useful.

The userInfo dictionary contains another dictionary that you can obtain using the aps key. You can access the contents of the aps dictionary—though you shouldn’t need to in most cases—using the following keys:

alert—The value may either be a string for the alert message or a dictionary with two keys: body and show-view. The value of the former is the alert message and the latter is a Boolean (false or true). If false, the alert’s View button is not shown. The default is to show the View button which, if the user taps it, launches the application.
badge—A number indicating the quantity of data items to download from the provider. This number is to be displayed on the application icon. The absence of a badge property indicates that any number currently badging the icon should be removed.
sound—The name of a sound file in the application bundle to play as an alert sound. If “default” is specified, the default sound should be played.
The userInfo dictionary may also have custom data defined by the provider according to the JSON schema. The properties for custom data should be specified at the same level as the aps dictionary. However, custom-defined properties should not be used for mass data transport because there is a strict size limit per notification (256 bytes) and delivery is not guaranteed.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-10-2010, 04:54 PM   #5 (permalink)
www.Alexj17.com
 
Alexj17's Avatar
 
Join Date: May 2009
Location: Liverpool, England
Posts: 181
Alexj17 is on a distinguished road
Send a message via Skype™ to Alexj17
Default

Quote:
Originally Posted by BrianSlick View Post
Maybe peek at the documentation?
Yeah i see all this in my log, but i cant extract just the alert message from it to output as my AlertView message. Sorry to be a pain and keep asking.
Alexj17 is offline   Reply With Quote
Old 08-10-2010, 04:56 PM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Do you know how to retrieve objects from dictionaries?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-10-2010, 05:02 PM   #7 (permalink)
www.Alexj17.com
 
Alexj17's Avatar
 
Join Date: May 2009
Location: Liverpool, England
Posts: 181
Alexj17 is on a distinguished road
Send a message via Skype™ to Alexj17
Default

Quote:
Originally Posted by BrianSlick View Post
Do you know how to retrieve objects from dictionaries?
i thought i did, i need to get 'alert' from [userInfo objectForKey:key]
Alexj17 is offline   Reply With Quote
Old 08-10-2010, 05:03 PM   #8 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Right, so first you need to get the dictionary using the aps key. Then from the second dictionary, retrieve the alert.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-10-2010, 05:08 PM   #9 (permalink)
www.Alexj17.com
 
Alexj17's Avatar
 
Join Date: May 2009
Location: Liverpool, England
Posts: 181
Alexj17 is on a distinguished road
Send a message via Skype™ to Alexj17
Default

Quote:
Originally Posted by BrianSlick View Post
Right, so first you need to get the dictionary using the aps key. Then from the second dictionary, retrieve the alert.
Right, sorted it, thanks alot !!!!!
Alexj17 is offline   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



» Advertisements
» Online Users: 353
10 members and 343 guests
bignoggins, Chickenrig, firecall, givensur, iNet, linkmx, michaelhansen, Objective Zero, PlutoPrime, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:39 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0