iOS - How to pass string from main app to widget without using app group - ios

As title, have any idea let widget get main app data?
As I know using App group to save & load the same suite userdefault.
Does have another way to achieve this feature?
Thanks.

AFAIK as you just mentioned the App groups is the way to go when sharing content between your main App and your widget.
Apple is really restrict about user data safety, and don't think there is there any other way to share content without using the app group as we can see on their documentation available here (Sharing Data with Your Containing App)
Something that would try is using a local notification I think this might work to trigger a local notification to your extension and handle the string on the other side :)
More details available here

Related

Pass text from iOS label to WatchOS label - swift-

I've a problem, with my app.. I try to follow some guide like Passing data to Apple Watch app , but I'm not sure it will fit for my case.
I've some label with text on my iOS app, then I want to show this text on my watchOS app label, and I don't know which is the best way to pass this text and keep it synchronized with the iOS app..
Thanks a lot for your help!
For watchOS1, Since Watch App is included as an extension in your Host App. So, you can use App Group to share data between your Host App and your App Extension.
Refer to https://stackoverflow.com/a/44654185/5716829 for more on using App Groups.
Since watchOS2, you don't have any built in function for communicating between the iOS and watchOS app than the WatchConnectivity framework.
From the information provided in your question, the updateApplicationContext(_:) function seems to be the best solution for your problem. You can send a dictionary of data with this function and the system tries to make sure that the data is received by the time your app is displayed to the user. If the function is called several times before the app would be visible to the user (run in the foreground), the system overwrites the previous data, so the Watch app only receives the most recent data to display.
The right method for this is WCSession.updateApplicationContext(_ applicationContext: [String : Any]) https://developer.apple.com/documentation/watchconnectivity/wcsession/1615621-updateapplicationcontext "Sends a dictionary of values that a paired and active device can use to synchronize its state."

Is it possible write the data in widget to the main app Coredata without group?

I found a lot of solution online, and many of them need to add the project into a group. But i do not own a developer account, i just a student, and i just want to make a widget and the user can interactive by using the button, and add to coredata in the main app, so is it any solution can help me? thanks
No, it's not possible. Extensions on iOS are separate processes from their apps. Sandboxing means that they can't access each other's data unless they use an app group. It's not just Core Data that has this rule, it's any kind of file access. If you won't set up an app group, you might try using a web service to store the data online. Both the app and the extension could use the same web service to share data.

Creating reminders using HTML widgets in iBooks Author

I'm writing a book in iBooks Author. I want to be able to tap on a widget and create reminders in the Reminders app, preferably without using another app as a middleman. Any ideas how I might be able to accomplish this?
Edit: I've found an undocumented URL scheme called x-apple-reminder://, but I can't find any information on arguments I can pass to it. Thoughts?
I don't believe the reminders app has an open API that can be accessed through the web (read: HTML). You will have to have a companion app that takes a custom URL and creates a reminder.

iOS first time user tutorial

I'm building an iPhone app and want to create a 1st time use tutorial for the user. I've seen some other apps use popover style baloons to guide the user through the UI and I'd like to do that as well. I have a popover library. What's the best way to create and track the steps of the tutorial?
I would go with NSUserDefaults. Just trigger some BOOL-ean values to change as each part finishes. I assume you want to continue the tutorial if the user quits the app, so this would be your best and easiest bet.
BOOLs for each dialog? Persisted however you want - NSUserDefaults or plist, json file, xml, whatever.
You can also use NSUbiquitousKeyValueStore if you want to setting to sync across devices using iCloud. If the user doesn't have iCloud configured it will just store it locally.

How to search the App Store programmatically and return App information

I would like to search the Apple App Store from within my app, and return App information such as Icon, Description, Name, etc.
I found some examples using URL's. But from what I understand, they cause your app to pause as it opens either the App Store or the browser. If I am mistaken, please may you provide me with an example on how to accomplish this (seemingly) simple task?
Regards,
Shane
I don't think there is an API available to do what you are describing directly in the iOS device. However, you could hack something together using the search API available from apple. Check it out at here. You could do this behind the scenes rather then using the browser. It's not a simple task, but it is doable. Besk of luck.

Resources