草庐IT

FIRA_AppDelegate

全部标签

objective-c - 如何在 AppDelegate 中决定 rootView

我正在学习iOS并开发我的第一个iPhone应用程序。我想在我的应用程序中添加一个功能:如果用户之前登录过,我想将用户重定向到主视图。否则,我想将用户重定向到登录View。我已阅读ioschangestoryboarddefaultviewcontrolleratruntime,但我想知道我是否可以在AppDelegate中编写决定RootView的代码。因此,我不会有一个永远不会启动的View。这是我在AppDelegate中的代码:-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:

ios - 在我的 AppDelegate 中保留一个 CLLocationManager 是一种好习惯吗?

我的应用监控用户位置,包括一些后台位置监控。我的AppDelegate中有一个位置管理器,主要用于初始启动位置和后台更新。然后我在我的ViewController(map)中有另一个管理器,用于更具体的事件和快速引用。我想知道将其重构为一个实例、保存在AppDelegate中并在整个应用程序中引用它是否是一个好习惯:self.appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];[self.appDelegate.locationManagerstartUpdatingLocation];

IOS 未知类型名称 appdelegate

我收到类似这样的错误:Unknowntypename'AppDelegate':Unknowntypename'AppDelegate':Propertywith'weak'attributemustbeofobjecttype我已经提到了很多这样的问题,但都给出了像添加这样的答案@classAppdelegate;我尝试编辑这段代码,但在这之后它给出了这样的错误:AppDelegate.m:23:18:Redefinitionof'ddLogLevel'因为这个日志在两个ViewController中都有定义。我也尝试从ViewController上方注释此日志的行,但它会给出错误:

ios - 如何在不是 AppDelegate 的另一个类中获取 devicetoken?

下午好。我是巴西人,请原谅我的任何英语错误!我正在向我自己的设备发送推送通知。我可以在我的AppDelegate.m中获取我的deviceToken:-(void)application:(UIApplication*)applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{NSLog(@"DeviceTokenGlobal:%@",deviceToken);}但我有一个名为LoginViewController.m的类,我在其中执行登录并将deviceToken发布到网络服务(将

ios - 为什么我每次需要使用它时都必须实例化 appdelegate?

目前,当我需要应用程序委托(delegate)的本地方法级实例时,我使用此代码:AppDelegate*appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];是否有某种更简单的“全局”方式来访问它?在C#等其他语言中,您可以创建公共(public)静态类,只需说...if(ObjectHelper.isLoggedin){//DoWork}但是当我想使用appdelegate时,我发现在objective-c中有点令人沮丧,我必须:在header中导入,实例化它的本地实例,实际得到一个我需要它的全局状态

iphone - 'Appdelegate' 没有可见的@interface 声明选择器 'setupTabBarController'

我在Appdelegate.m中创建了一个方法-(void)setupTabBarController{//detailsgoeshere}现在在ABC.m中,我想访问setupTabBarController我已经包含了应用委托(delegate):#import"AppDelegate.h"然后:AppDelegate*maindelegate=[[AppDelegatealloc]init];[maindelegatesetupTabBarController];但是显示错误,Novisible@interfacefor'Appdelegate'declarestheselect

iphone - 使用未声明的标识符 'AppDelegate'

为什么使用此代码会收到此错误消息?“使用未声明的标识符‘AppDelegate’intmain(intargc,char*argv[]){@autoreleasepool{returnUIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegateclass]));}} 最佳答案 您是否导入了应用委托(delegate)?#import"AppDelegate.h" 关于iphone-使用未声明的标识符'AppDelegate'

iphone - 从 UIViewController 到 Appdelegate 的导航

我正在尝试通过单击按钮从UIViewController类(名称为CartViewController)导航到Appdelegate(名称为SimpleDemoAppDelegate)。按钮上IBAction的方法和代码是-(IBAction)Go{AppDelegate*appDelegate=(AppDelegate*)[UIApplicationsharedApplication].delegate;UIViewController*presentingViewController=appDelegate.viewController;}我也试过-(IBAction)Go{Sim

objective-c - AppDelegate 未找到 ViewController 的声明和合成属性

我的应用程序已经开发了几个月,现在被要求添加核心数据。SMH。这是一个tabViewController应用程序。我不知道这是否有助于回答。所以我在这里尝试添加它,但出现错误。我在AppDelegate.h中构建核心数据,因此我创建了这些IVAR并稍后在.m中适本地构建它们。@property(readonly,strong,nonatomic)NSManagedObjectContext*managedObjectContext;@property(readonly,strong,nonatomic)NSManagedObjectModel*managedObjectModel;@p

ios - AppDelegate window.rootViewController 属性

我的iOS应用程序有问题。它基于Storyboard。因此,要设置rootViewController属性,将InterfaceBuilder中的“InitialViewController”属性和项目设置中的MainInterface-Property设置为我的Storyboard的名称就足够了。我仍然总是收到消息“应用程序窗口应该在应用程序启动结束时有一个RootViewController”。我在applicationDidFinishLaunching部分做了几件事,但即使除了返回YES之外的所有内容;被注释掉了,我收到了消息。我该如何解决这个警告?或者我可以在一切正常时忽略它