jjzjj

Appdelegate

全部标签

ios - 如何在 didRegisterForRemoteNotificationsWithDeviceToken 以外的方法中使用设备 token ?

我通过didRegisterForRemoteNotificationsWithDeviceToken方法获得了设备token。我想以另一种方法使用设备token。我是这样试的,在didRegisterForRemoteNotificationsWithDeviceToken方法中:str=[NSStringstringWithFormat:@"%@",deviceToken];//stristheNSStringwhichisdeclaredintheappDelegate.hfileasglobalvariable在didReceiveRemoteNotification方法中:N

iphone - 试图在 appDelegate 中保存 NSManagedObject

当我尝试在委托(delegate)中保存NSManageObject时,我遇到了很多麻烦,最糟糕的问题是尝试读取对象。我的代表是这样的:@classViewController;@classRootViewController;@interfaceAppDelegate:UIResponder{NSManagedObjectModel*managedObjectModel;NSManagedObjectContext*managedObjectContext;NSPersistentStoreCoordinator*persistentStoreCoordinator;Trips*tr

ios - 如何在 AppDelegate 中获取 Storyboard UITabBarController 的指针

我正在使用Storyboard来创建我的应用程序。我的应用程序的根是一个UITabBarController。如何从我的ApplicationDelegate中访问我的tabBarController?我设法从我的一个UIViewController中成功地实现了操作。但我想将代码移至我的应用程序委托(delegate)。我怎样才能做到这一点?我以为我可以从Storyboard中拖放到我的应用程序委托(delegate)中,然后得到类似的东西@property(nonatomic,strong)IBOutletUITabBarController*tabBarController;但这

iphone - iOS:对正确使用 AppDelegate 感到困惑

对于iOS开发人员来说仍然是个新手(有asp.net/web的背景),而且我不认为我已经完全理解所有事情之间的关系。例如,我目前正在构建一个以NavigationController开头的应用程序。我很高兴地传入和传出ViewControllers,一切正常,但现在我需要向导航Controller添加一个右键。我已经从这样的ViewControllers之一中完成了此操作:-(void)viewDidLoad{UIBarButtonItem*change=[[UIBarButtonItemalloc]initWithTitle:@"CHANGE"style:UIBarButtonIte

ios - 如何从 AppDelegate.m 访问 tabBarController?

这是我的Storyboard:我正在尝试从AppDelegate.m中的方法访问tabBarController这是AppDelegate.h:#import#import#import"STAlertView.h"@interfacedemo_AppDelegate:UIResponder@property(strong,nonatomic)UIWindow*window;@property(nonatomic,strong)STAlertView*av;@end这是AppDelegate.m:#import"demo_AppDelegate.h"#import"demo_Frien

ios - 获取错误线程 1 : EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when loading AVPlayer

当我选择一个collectionViewCell时,我试图加载一个AVPlayer,这是我在didSelectItem中的代码:funccollectionView(_collectionView:UICollectionView,didSelectItemAtindexPath:IndexPath){ifletitem=items?[indexPath.item]{showPlayer(item:item)}}funcshowPlayer(item:Item){letplayerLauncher=PlayerLauncher()playerLauncher.showVideoPlay

ios - 如何将数据从 AppDelegate 传递到 ViewController?

我正在使用Safari浏览网页。单击此页面上的按钮后,我的Ipad将启动我的应用程序。所以我在AppDelegate.m中实现了方法-(BOOL)application:(UIApplication*)applicationhandleOpenURL:(NSURL*)url。-(BOOL)application:(UIApplication*)applicationhandleOpenURL:(NSURL*)url{if(!url){returnNO;}NSString*URLString=[urlabsoluteString];self.paramArray=[URLStringco

ios - iOS Objective-C 中 Singleton 类和 AppDelegate 类的关系

我在AppDelegate类(.h文件)中声明了一个变量,其值从多个ViewController类中更改。此外,我的AppDelegate类的单个应用程序范围实例在整个应用程序中共享,如下所示:AppDelegate*AppD=(AppDelegate*)[[UIApplicationsharedApplication]delegate];因为我可以从任何ViewController类访问在AppDelegate中声明的这个变量,在这种情况下,AppDelegate类是否作为Singleton类的示例?任何人都可以通过现实生活中的例子帮助找出单例类的用法吗?

iphone - NSTimer 不从 AppDelegate 重复

为什么这在appDidFinishLaunching中不会重复?self.ti=[NSTimertimerWithTimeInterval:10.target:selfselector:@selector(bounce:)userInfo:nilrepeats:YES];[self.tifire];非常感谢朱尔斯 最佳答案 我认为您的bounce签名有误。应该是-(void)bounce:(NSTimer*)theTimer{NSLog(@"Here...");}您应该使用selector(bounce:)来安排此方法。您还应该调用

ios - 如何在 iOS 中从 AppDelegate 调用 View Controller

我正在创建一个iOS应用程序,其中我有以下要求:应用程序应在第一次启动时显示登录屏幕,并且当应用程序从后台转到前台时也必须显示该屏幕,在如果它在运行时已被发送到后台。在这两种情况下,我都处理过显示屏幕。然而,当我这样做并且应用程序从后台出现时,我单击texfield以输入我的密码,应用程序被卡住,并且它在一个线程中失败,我不知道它是什么意思。我在AppDelegate的applicationWillEnterForeground中调用应用程序来自后台时显示的屏幕:self.window=[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen