Hello I'm working on something where I need to pass some data from a target to another (basically an app to another) and I red that App Groups is the way to do it .
I've made a class to manage that .
class PaywallHelper {
static let sharedDefaults = UserDefaults.init(suiteName: "group.Myapp")!
var tokenForPaywall: String? {
get {
return PaywallHelper.sharedDefaults.string(forKey: "user_token")
}
set {
PaywallHelper.sharedDefaults.setValue(newValue, forKey: "user_token")
PaywallHelper.sharedDefaults.synchronize()
}
}
var ad_id: Int? {
get {
return PaywallHelper.sharedDefaults.integer(forKey: "id")
}
set {
PaywallHelper.sharedDefaults.setValue(newValue, forKey: "id")
PaywallHelper.sharedDefaults.synchronize()
}
}
var category_id: Int? {
get {
return PaywallHelper.sharedDefaults.integer(forKey: "category_id")
}
set {
PaywallHelper.sharedDefaults.setValue(newValue, forKey: "category_id")
PaywallHelper.sharedDefaults.synchronize()
}
}
also I have enabled the App Groups from Capabilities ...but what botheres me here is that it is red... ..
The thing is it is working fine on simulator I receive the data and i can work with them...as for the real device it s not working...What am I doing wrong?