每当我启动FireBase应用程序时,它都会记录各种Firebase功能的状态.现在这是记录的内容:
Configuring the default app.
<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
<FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
<FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
<FIRAnalytics/INFO> Firebase Analytics enabled
Run Code Online (Sandbox Code Playgroud)
我查看了pod并且没有找到任何打印语句,那么我怎样才能阻止这些超时记录我运行应用程序?
我试图让我的应用程序打开苹果地图应用程序,并将地址拉起来.我试过这个:
- (IBAction)openInMaps:(id)sender {
NSString *addressString = @"http://maps.apple.com/?q=1 Infinite Loop, Cupertino, CA";
NSURL *url = [NSURL URLWithString:addressString];
[[UIApplication sharedApplication] openURL:url];
}
Run Code Online (Sandbox Code Playgroud)
还有这个 :
- (IBAction)openInMaps:(id)sender {
NSString *addressString = @"http://maps.apple.com/?q=1_Infinite_Loop,_Cupertino,_CA";
NSURL *url = [NSURL URLWithString:addressString];
[[UIApplication sharedApplication] openURL:url];
}
Run Code Online (Sandbox Code Playgroud)
但是这个按钮的作用就像没有任何东西.但这确实有效:
- (IBAction)openInMaps:(id)sender {
NSString *addressString = @"http://maps.apple.com/?q=Cupertino,CA";
NSURL *url = [NSURL URLWithString:addressString];
[[UIApplication sharedApplication] openURL:url];
}
Run Code Online (Sandbox Code Playgroud)
所以,只要它们是一个空间,它就不起作用.我该如何打开这个地址?
因此,我现在在应用程序商店中有一个应用程序,提前安排10个通知,假设您错过了一个,您仍将获得第二次机会或十个.在你认为我会打扰这个人之前,通知对于应用程序的功能非常重要,而且确实是主要目的.该应用程序是为iOS 7构建的,因此当时没有"handleActionWithIdentifier",根据我的理解,即使关闭应用程序,也可以完成对应用程序的操作,具体取决于用户对通知的响应.此更新对应用程序非常有用,因为它消除了我必须打开应用程序以响应通知的部分问题(通知询问用户一个问题,并根据答案,完成一些事情).
剩下的问题是检测是否错过了通知,如果通知被取消或忽略,我将如何显示另一个通知,例如第二天.我在google和堆栈溢出搜索了这个,根据我的理解,所有以前的问题一直在询问如何检测通知是否错过了应用程序打开,我不需要.
此时,如果用户通过按下通知中的一个选项来响应通知,则可以正常运行代码:
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forLocalNotification notification: UILocalNotification, withResponseInfo responseInfo: [NSObject : AnyObject], completionHandler: () -> Void) {
var userInfo = [NSObject: AnyObject]()
userInfo["text"] = responseInfo[UIUserNotificationActionResponseTypedTextKey]
NSNotificationCenter.defaultCenter().postNotificationName("text", object: nil, userInfo: userInfo)
print(userInfo)
completionHandler()
}
Run Code Online (Sandbox Code Playgroud)
截至目前,我只是采取文本输入并打印它,但如果我愿意,我可以发出第二个通知.有没有一种方法来检测何时错过通知并安排另一个通知?
总是有可能仍然不可能做我想要的事情,我只是预先安排10个通知,这看起来很草率,不让我做出反复的回应.
TLDR; 如果在未打开应用程序的情况下错过本地通知,如何检测并运行代码
顺便说一句:如果你有答案,swift是首选语言
我想改变我的文字UITabBarItems,并使用问题,比如这个.第二个答案对我很有用,除非我尝试调整字体UITabBarItem.此代码段生成所选文本的预期结果为白色,未选中的项目为浅灰色:
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.blackColor()], forState:.Normal)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:.Selected)
Run Code Online (Sandbox Code Playgroud)
但是,如果添加:
UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName:UIFont(name: "American Typewriter", size: 13)!], forState: .Selected)
Run Code Online (Sandbox Code Playgroud)
由于某种原因,当文本被选中和未被选中时,文本变为黑色,并且字体保持不变.
奇怪的是,如果我更改.Selected到.Normal最后一个片段,那么所选文本将变为白色,文本将与代码中的字体匹配.
UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName:UIFont(name: "American Typewriter", size: 13)!], forState: .Normal)
Run Code Online (Sandbox Code Playgroud)
这几乎是完美的,但是未选择的文本现在没有变化.我不确定我做错了什么或这是一个错误,但如果有任何其他方法来完成这项任务,我很乐意听到它.
基于dfri的评论,我试过这个:
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.blackColor(),
NSFontAttributeName : [NSFontAttributeName:UIFont(name: "American Typewriter", size: 13)!]], forState:.Selected)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.whiteColor(),
NSFontAttributeName : [NSFontAttributeName:UIFont(name: "American Typewriter", size: 13)!]], forState:.Normal)
Run Code Online (Sandbox Code Playgroud)
现在应用程序崩溃了.错误说:
无法识别的选择器发送到实例0x7fa6d9461ef0
这对我没有任何意义