我有一个我在 xCode 中创建为“基于视图的应用程序”的 iOS 应用程序。我只有一个 viewController,但它会自动显示,而且我看不到将它与我的 appDelegate 关联的代码。我需要将数据从我的 appDelegate 传递到我的 viewController,但不知道如何实现。
我的应用委托.h:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) NSDictionary *queryStrings;
@end
此外,appDidFinishLoadingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[JMC sharedInstance] configureJiraConnect:@"https://cmsmech.atlassian.net/" projectKey:@"WTUPLOAD" apiKey:@"7fc060e1-a795-4135-89c6-a7e8e64c4b13"];
if ([launchOptions objectForKey:UIApplicationLaunchOptionsURLKey] != nil) {
NSURL *url = [launchOptions objectForKey: UIApplicationLaunchOptionsURLKey];
NSLog(@"url received: %@", url);
NSLog(@"query string: %@", [url query]);
NSLog(@"host: %@", [url host]);
NSLog(@"url path: %@", [url path]);
queryStrings = [self parseQueryString:[url query]];
NSLog(@"query dictionary: %@", queryStrings);
}
else {
queryStrings = [self parseQueryString:@"wtID=nil"];
}
return YES;
}