单击按钮时如何将VC上的变量传递给extensionVC?我尝试了用户默认设置,但是没有用。我尝试了类似的方法,但这也没有用。

VC:

let appGroupDefaults = UserDefaults(suiteName:"group.com.ReelKapi")!
    appGroupDefaults.set(secilenKapi, forKey: "secilenKapi")

今日扩展:
appGroupDefaults = UserDefaults(suiteName:"group.com.ReelKapi")!
    var gelenKapi = appGroupDefaults.value(forKey: "secilenKapi")! as? String
    if let yansiyan = gelenKapi {

        gelenKapi = yansiyan
    }

最佳答案

Check this tutorial(BLOCK), i thinks its resolve your problem.

  • 重复Cannot access NSUserDefaults using app groups one to another
  • 关于ios - 如何将数据 View Controller 传递给扩展,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43935388/

    10-11 05:28