Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lng

macrumors newbie
Original poster
Jul 19, 2010
8
0
Hi, I have searched and read so many pages, but even though tried so many different codes, I couldn't get it working. Here is the situation:

I have a tabcontroller which its first tab has a view and inside the view there is a UIWebView. Normally when a push notification comes for the app and when user clicks to View button, when app is loading, I parse the the push msg and on ViewController, I rediret the UIWebView to proper page.

But when the push comes inside the app and when user clicks the View button, I needed to call the ViewController function from AppDelegate to redirect UIWebView to proper page. Somehow I got rid of the errors, but now it is doing nothing. Here are the codes:

MainViewController.m

Code:
- (void) gotoProperPage {
    NSString *gameURL = [@"http://game.com?game?id="stringByAppendingString:appDelegate.gameID];
    [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:gameURL]]];
}

MyAppDelegate.h

Code:
@class MainViewController;

@interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
	MainViewController *mvc;
}

@property (nonatomic, retain) IBOutlet MainViewController *mvc;

MyAppDelegate.m

Code:
#import "MainViewController.h"

@implementation MSLiteAppDelegate

@synthesize mvc;
...
- (void) someMethod{
[mvc gotoProperPage];
}
...
 

lng

macrumors newbie
Original poster
Jul 19, 2010
8
0
When and how are you calling someMethod?

Sorry if I didn't make it clear. "someMethod" is the appDelegate method which I try to call my "gotoProperPage" method from viewController.

To be clear, when push notf. calls the
Code:
(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
event, I show up an alert and check the user's action with
Code:
(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex

Actually that's my someMethod.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.