小编Suh*_*til的帖子

什么是无声推送通知?设备什么时候收到?

我想在通知栏中清除我的本地通知.为了实现这一点,我想使用静默推送通知.所以我想确认设备何时收到它以及我可以用它做什么?

apple-push-notifications ios

51
推荐指数
2
解决办法
6万
查看次数

在 Swift 中安装“Firebase/Crashlytics”pod 时出错

我正在将 pod 'Firebase/Crashlytics' 安装到我的 Xcode 项目中。项目配置为:XCode:10.3 Swift 版本:4.2 Pod 版本:1.8.0.beta.2

pod安装后报错:

[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
  In snapshot (Podfile.lock):
    Firebase/CoreOnly (= 6.4.0)

  In Podfile:
    Firebase/Auth was resolved to 6.4.0, which depends on
      Firebase/CoreOnly (= 6.4.0)

    Firebase/Crashlytics was resolved to 6.15.0, which depends on
      Firebase/CoreOnly (= 6.15.0)

[!] Automatically assigning platform `iOS` with version `11.0` on target `Projects` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Run Code Online (Sandbox Code Playgroud)

我的 …

cocoapods firebase swift

10
推荐指数
2
解决办法
6174
查看次数

本地化设置不会改变 Swift 4.2 中系统定义的文本

我的应用程序有 2 个语言支持 1) 英语 - en 2) 德语 - de

我已经完成了所有本地化程序,唯一的问题是每当我将语言从“en”更改为“de”,反之亦然,然后在系统文本没有更改为最新的语言之后,但它会在我杀死应用程序时反映出来并重新打开它。

例如:

在此处输入图片说明

popover Copy-LookUp-Share 不本地化为 German Lang。但是 .string 文件中的其他内容已正确处理。

我的更改语言代码:

func setLanguage(languageCode:String) {
        var appleLanguages = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
        appleLanguages.remove(at: 0)
        appleLanguages.insert(languageCode, at: 0)
        UserDefaults.standard.set(appleLanguages, forKey: "AppleLanguages")
        UserDefaults.standard.synchronize()

        if let languageDirectoryPath = Bundle.main.path(forResource: languageCode, ofType: "lproj")  {
            bundle = Bundle.init(path: languageDirectoryPath)
        } else {
            resetLocalization()
        }
        }


    func resetLocalization() {
        bundle = Bundle.main
    }
Run Code Online (Sandbox Code Playgroud)

仅供参考:类似的事情发生在“微信”iOS 应用程序中。

localization objective-c ios swift

7
推荐指数
1
解决办法
212
查看次数