ios-app-group

How to transfer Realm database to appgroups

浪尽此生 提交于 2021-02-11 08:27:28
问题 Hey I have an app that uses Real to persist data. I used the default realm file directory to store the apps data but I would like to move the file directory to app groups in order to create app extensions. Heres my code for changing the file path var config = Realm.Configuration() config.fileURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.bundle.identifier")!.appendingPathComponent("default.realm") Realm.Configuration.defaultConfiguration = config The

How to debug an iOS app extension?

淺唱寂寞╮ 提交于 2020-07-05 09:14:02
问题 I'm trying to debug an iOS app extension and all I can do is to set breakpoints but it would be nice to be able to print to console. Is this possible with Xcode 9? Or at least read it somewhere, maybe a file? I went to see my device's logs in "devices and simulators" but could't find what I printed from my iOS app extension. 回答1: You can debug an app extension like any other app by just choosing target and device and then running the extension. You need to choose an app to run with the

How to debug an iOS app extension?

倾然丶 夕夏残阳落幕 提交于 2020-07-05 09:11:29
问题 I'm trying to debug an iOS app extension and all I can do is to set breakpoints but it would be nice to be able to print to console. Is this possible with Xcode 9? Or at least read it somewhere, maybe a file? I went to see my device's logs in "devices and simulators" but could't find what I printed from my iOS app extension. 回答1: You can debug an app extension like any other app by just choosing target and device and then running the extension. You need to choose an app to run with the

How to Migrate Core Data's Data to App Group's Data

筅森魡賤 提交于 2020-06-11 11:47:53
问题 I just added App Groups to my app using this StackOverFlow post. Unfortunately since the defaultDirectoryURL is changing, I can not fetch any of the old data I made before using the App Groups directory. I know the data is still there because when I switch back to using a regular NSPersistentContainer instead of the GroupedPersistentContainer , I can get the data. How can I migrate my old data over to where I'm fetching the app group's data? Core Data code: class CoreDataManager { static let

How to Migrate Core Data's Data to App Group's Data

淺唱寂寞╮ 提交于 2020-06-11 11:46:16
问题 I just added App Groups to my app using this StackOverFlow post. Unfortunately since the defaultDirectoryURL is changing, I can not fetch any of the old data I made before using the App Groups directory. I know the data is still there because when I switch back to using a regular NSPersistentContainer instead of the GroupedPersistentContainer , I can get the data. How can I migrate my old data over to where I'm fetching the app group's data? Core Data code: class CoreDataManager { static let

App Groups forSecurityApplicationGroupIdentifier returns nil

前提是你 提交于 2020-05-26 10:12:05
问题 I set up an App Group to use with my Today Extension. I added the app group in the main app's target and in the extension's target. In my App ID Configuration in the developer portal I have the app group enabled. But for some reason FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: id) returns nil whenever I call it. I have tripled checked the forSecurityApplicationGroupIdentifier string and know it's correct. Does anyone have any idea why this is not working? EDIT: I

App Groups forSecurityApplicationGroupIdentifier returns nil

夙愿已清 提交于 2020-05-26 10:11:01
问题 I set up an App Group to use with my Today Extension. I added the app group in the main app's target and in the extension's target. In my App ID Configuration in the developer portal I have the app group enabled. But for some reason FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: id) returns nil whenever I call it. I have tripled checked the forSecurityApplicationGroupIdentifier string and know it's correct. Does anyone have any idea why this is not working? EDIT: I

Sharing data between app extension and conainer app

折月煮酒 提交于 2020-01-16 00:42:11
问题 I'm trying to share data between an app extension and my container app. I setup an app group in the container app and referenced it my app extension. When my app extension is accessed, I save an object to NSUserDefaults //in the app extension -(void)viewDidLoad { NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.mygroup.com"]; [defaults setObject:[NSDate date] forKey:@"Date"]; [defaults synchronize]; } and in the container app - when it is launched I setup an

Why doesn't NSUserDefaults work between my app & share extension?

╄→гoц情女王★ 提交于 2020-01-11 10:10:24
问题 I have an iOS app with a share extension. I am trying to share data between them using NSUserDefaults and App Groups but, while I can write into the NSUD object, read it, and synchronize() without error, reading in the extension always results in nil . I have an app group, the literal string "group.net.foo.bar" for which both the app & extension have configured under Capabilities -> App Groups. This string is in a constants struct in my app: struct Forum { static let APP_GROUP = "group.net