草庐IT

Uiapplication

全部标签

ios - UIApplication 图标角标(Badge)编号在重新安装时保留

这个问题在这里已经有了答案:Badgecountispersistedafterdeletinganappandinstallingitagain(4个答案)关闭5年前。UIApplication标记号在重新安装时不会被删除。如果我在角标(Badge)具有非零值时卸载应用程序,然后重新安装它,角标(Badge)仍会出现在新安装中。我按以下方式更新角标(Badge)编号:[[UIApplicationsharedApplication]setApplicationIconBadgeNumber:badgeNumber];试图找到解决方案-当应用程序终止时发出一些通知,以便我可以删除角标(

ios - UIKit-[UIApplication sendAction :to:from:forEvent:] crash

我遇到了一个非常不寻常的问题..我在UIKit上崩溃了..我第一次遇到这样的事情..请任何人指导我..这是我得到的崩溃日志。Crashed:com.apple.main-threadEXC_BAD_ACCESSKERN_INVALID_ADDRESSat0x1161a18cThread:Crashed:com.apple.main-thread0libobjc.A.dylib0x386fcb66objc_msgSend+51UIKit0x30b5dda3-[UIApplicationsendAction:to:from:forEvent:]+902UIKit0x30cc5615-[UI

ios - -[UIApplication _runWithMainScene :transitionContext:completion:], 中的断言失败

我仅在iOS9中收到以下错误。这是我的代码:--(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{self.window=[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];if([[NSUserDefaultsstandardUserDefaults]objectForKey:@"login_dict"]){if([[NSUserDefaultsstandard

iphone - 子类化 UIApplication 以覆盖 sendEvent 导致崩溃

我正在尝试子类UIApplication来捕获所有触摸事件,这用于查看用户是否离开。无论如何,它在您第一次启动该应用程序时效果很好。如果你把它放在后台并再次打开它2次,它就会崩溃。我不知道是什么原因造成的。我在[supersendEvent:event]上获得EXEC_BAD_ACCESS;我的子类MyUI:@implementationMyUI-(void)sendEvent:(UIEvent*)event{[supersendEvent:event];//主.mintmain(intargc,char*argv[]){NSString*appClass=@"MyUI";NSAuto

ios - UIApplication 发送操作 :to:from:forEvent: iOS7 no user code

我遇到了仅在iOS7上发生的崩溃。该应用程序是针对6.1sdk编译的。我自己无法重现此问题,但我可以从崩溃报告中看到某些用户正在发生这种情况。问题是堆栈跟踪中没有用户代码,因此很难追踪:ExceptionType:EXC_BAD_ACCESSCode:KERN_INVALID_ADDRESSat0x130libobjc.A.dylibobjc_msgSend+51UIKit-[UIApplicationsendAction:to:from:forEvent:]+902UIKit-[UIApplicationsendAction:toTarget:fromSender:forEvent:

ios - 状态栏是横向的,但是 [[UIApplication sharedApplication] statusBarOrientation] 返回纵向

这个问题似乎是间歇性的,但我不确定具体原因。在设备(iPad)上运行我的应用程序时,我有一些代码可以根据当前设备方向加载带有一些ImageView的ScrollView。尽管设备在加载前是横向的,但加载View时就好像它是纵向的一样。方向是通过调用[[UIApplicationsharedApplication]statusBarOrientation]找到的。View被设置为在设备旋转时调整它们的位置,事实上,旋转到纵向然后回到横向会使它们回到正确的横向位置。是否所有应用程序都以纵向模式开始,并在需要时很快更改为横向模式?我是否尝试过早检查方向(在要加载的第一个ViewControl

ios - UIApplication.sharedApplication 不可用

我正在尝试从UIViewController获取对我的应用程序委托(delegate)的引用,但我不断收到此错误消息:'sharedApplication()'isunavailable:Useviewcontrollerbasedsolutionswhereappropriateinstead.我一直在阅读所有处理此类消息的文章,但我的问题似乎与此无关,因为我没有使用任何第三方框架。虽然TodayExtension是我的应用程序的一部分,但发生错误的类完全无关。我什至创建了一个全新的类并不断收到相同的错误:当我在Playground上做同样的事情时,效果很好。我错过了什么?

swift - 如何在 Swift 中模拟 UIApplication?

我目前正在使用Quick+Nimble在Swift中进行单元测试。我正在构建一个Inviter类,它通过不同的方法发送应用邀请。我需要模拟UIApplication以验证我的代码是否调用了openURL。到目前为止我的代码:importQuickimportNimbleimportOCMockextensionInviter{convenienceinit(usingMockApplicationmockApplication:UIApplication){self.init()application=mockApplication}}classMockUIApplication:UI

ios - `_statusBarTintColorLockingControllers` 处的属性 `UIApplication` 将 ViewController 保留在内存中

使用Xcode8新内存调试器,我发现内存中有一个不应该存在的ViewController,指向它的强引用来自UIApplication中这个神秘的_statusBarTintColorLockingControllers数组。有人知道它来自哪里吗?更重要的是,如何让我的VC摆脱困境? 最佳答案 _statusBarTintColorLockingControllers似乎不是这里的真正问题。我有相同的内存图,直到我解决了一个保留周期,我在委托(delegate)属性上忘记了weak。 关

swift - 类型 'Notification.Name'(又名 'NSNotification.Name')没有成员 'UIApplication'

首先它说'UIApplicationDidEnterBackground'hasbeenrenamedto'UIApplication.didEnterBackgroundNotification'当我点它时,它说Type'Notification.Name'(aka'NSNotification.Name')hasnomember'UIApplication'funclistenForBackgroundNotification(){observer=NotificationCenter.default.addObserver(forName:Notification.Name.UI