SKStoreReviewController requestReview does not work in iMessage extension - ios

I tried calling SKStoreReviewController.requestReview() in my iMessage extension, but it never shows the UI. I know the system controls whether or not this appears, but based on the documentation (https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview) it seems like it should appear at least once.
If I move the call to the containing app, it works as expected. The entire user experience is based out of the imessage extension, so this is not really a viable solution

Related

Request for access to photo library prompt stays in the background

My request for photo library permissions prompt is supposed to pop up as soon as the app is launched. I have set up my info.plist with the library permission.
I have tried both adding/removing the requestAuthorization(_:) function in my AppDelegate.swift in various lifecycle functions.
Current output: The app launches and stays on the launchscreen. When i click on the home button the app minimizes and the permissions prompt appears(as though it was lingering in the background). On allowing permission everything launches as expected.
Desired output: The app launches and the photo library permissions prompt appears on top(as it should). On click of which everything runs as usual.
I can attach pictures if this is not descriptive enough. Also there is no pertaining code as i have removed the requestAuthorization(_:) function(cuz not required). Any tip would go a long way as I have been fiddling with this for days now trying to get this fixed. Thank you!
Your request call should be in the view controller (i.e. viewDidAppear), not the AppDelegate. Having the call in the app delegate is probably causing it to fire at an inappropriate time.

How to open the companion app and go back in from a keyboard extension in iOS

So, I have this requirement where a keyboard extension must be able to open it's companion app and have the user take a specific action in there and then be able to go back to whatever previous app was opened and input some text in the previously selected text field.
Basically, if you take a look at Scandit Keyboard Wedge you'll see that behaviour: the user opens can press the "Scan" button on the custom keyboard and is taken in the companion app. Once a barcode is scanned the app automatically goes back to the previous opened app and inputs the barcode string into the text field that was being edited.
Now, reading through Apple's documentation I see a mention saying that a keyboard extension is not permitted to open another apps. Does this include it's own companion app?
Also, even so, I'm not really sure how I can have the keyboard extension open a custom URL since UIApplication.shared is not available in the keyboard extension.
Now, my second problem is, how does the companion app go back to the previously opened app?
Same goes for Google's own custom keyboard. Now, I found a question about this one here on SO. The answer suggests that this is using a private API to handle this thing. But then I'm curious: how did this even go throw Apple's review process? Am I expected to have my app rejected?

Show several Local Notifications without creating new one

My scenario that I need to show the first Local Notification using Swift and then using the same identifier add another Local Notification, but without showing it as a popup in iOS device. So basically the flow would be like this:
Starting upload... <-- Show on the screen and adds to the Tray bar
Uploading photos... <-- Does not shows on the screen, but clears all the notifications and add another one in Tray bar silently (or changes previous one)
Uploading data... <-- Same as Uploading photos...
Finished uploading... <-- Same as Uploading photos...
Tried different ways, on Android it is not hard to do that, but iOS makes everything hard to do, is it even possible? :)
Thanks!
The reason it works on Android is because the "state showing" notifications are very Android thing. iOS is not designed for this kind of stuff because you almost never do something in the background of an app that also needs to be reflected to the user while user is outside of an app. So the real answer to your question is no. In iOS environment it is not possible to simulate Android way of showing status changes in a notification.

When will getPlaceholderTemplateForComplication() method be called?

I'm trying to build a simple complication template for a WatchOS app, but I'm stuck trying to understand when will the ComplicationController class's method getPlaceholderTemplateForComplication() be called.
Apple's documentation says
When your app is first launched, ClockKit calls this method,
but if i run the simulator, it most often won't fire.
Turning the "Show App on Apple Watch" switch off and back on doesn't help.
When will getPlaceholderTemplateForComplication() method be called?
The placeholder template is called when you are customizing the watch face and selecting which complication will be shown. The system calls getPlaceholderTemplateForComplication() once, then caches the result. It won't keep calling the method every time you customize the complication.
As you scroll through the complication choices, the static details shown there are the details returned for the placeholder template.
Once your complication is active -- shown on the watch face -- the placeholder template does not get called. Instead the timeline entries come from these complication dataSource methods:
getCurrentTimelineEntryForComplication, and optionally from
getTimelineEntriesForComplication if time travel is supported.
Installing or removing a watch app has nothing to do with the placeholder template.
For watchOS 3:
watchOS 3 supports a face gallery which can let the user see and customize watch faces and complications. The static complication data shown in the gallery also comes from the placeholder template.

UILocalNotifcation custom fire event, or struggle on with NSTimer

I have a state-transition problem with NSTimer, of which I find difficult to keep track of during applicationWillResignActive / applicationDidEnterBackground, according to the context of my app.
I was wondering if it might not be a better idea to utilise UILocalNotification, especially given it's background/inactive firing. However, I wanted to know whether we have the ability to provide a custom method to UILocalNotification, of which does not present a dialog box (would damage the whole point of my app). In effect, i'd like to only make use of the timer-fire capabilities of UILocalNotification, and handle the fire event with my own method which does something very "undialog-friendly"
Have checked the ADC docs and it alludes to the dialog being presented every time.
Any advice you can give on this would be appreciated.
thanks
sc.
The dialog box is presented when your app is in the background. But it is not presented when your app is running - instead your app is free to deal with the notification however it sees fit. So it would be perfectly possible to hook it up to a custom method of your own making.
The main reason for this behaviour is a user may not want to go into your app if it's in the background. Of course, with iOS 5 the notification may not be a dialog box - it could be one of the new notification styles.

Resources