How to remove 3D touch quick action thats added using swift code - ios

I have started playing with 3D touch quick actions for my app for iPhone 6S using code from apples developer site
This worked fine, but now i am unable to remove these quick actions.I only made changes to AppDelegate and I have removed this sample code from AppDelegate but quick actions still remain. Info.plist does not have any quick actions. Any ideas?

If you removed the code, than just delete app from your phone and rerun it.
If you need to do it programmatically for any reason, just call this function
func removeAllDynamicQuickActions() {
UIApplication.shared.shortcutItems?.removeAll()
}

Related

Game Center Completion Banner not showing in iOS Simulator

I'm trying to integrate Game Center into my iOS app. However, the achievement completion banner doesn't appear even if I set the ShowsCompletionBanner flag to true. I've been testing my app through iOS Simulator with iOS 14.
I'm using the following code (Xamarin.iOS):
var achievement = new GKAchievement("sample.achievement")
{
PercentComplete = 100,
ShowsCompletionBanner = true
};
achievement.ReportAchievement(null);
I can confirm that the ReportAchievement has succeeded since the achievement has been unlocked in the achievements view (GKGameCenterViewControllerState.achievements)
Added info: The completion banner appears when I put a breakpoint at the achievement.ReportAchievement(null) line. Also tried using achievement.ReportAchievementAsync() but I'm still encountering the same behavior.
Thanks in advance!
Try using static ReportAchievements instead of instance method being used.
You can see that in the Apple developer document https://developer.apple.com/documentation/gamekit/gkachievement?language=objc
But we also want info in where the API is being called from as there still may be an issue with async and timing.
Might be worth using a completion handler with the synchronous method which may reveal an error.

App Screen Goes black when tap on UIAlertAction

I am working on existing swift app written in Swift 4.0. I am getting strange issue in any of screen If I tried to use UIAlertController with UIAlertAction in form of alert or action sheet. As soon as I tap on UIAlertAction Button complete screen goes black(Blank) and I need to force quit to restart app, I am getting this on iOS 14.7.1....
I tried to use alert on Main Thread, added scene delegate as well as Deployment target is iOS 13.0 But no luck and interesting part is If I run app with Xcode everything works fine but if I tried to use app on device directly without run, getting this strange issue....Any Suggestions...
Thanks in advance....
I got solution for now, after seeing Debug View Hierarchy I got on tap of UIAlertAction, it remove window that's why complete app goes blank, So I created new window for showing Alert. I followed this stack OverFlow Answer Every UIAlertController disappear automatically before user responds - since iOS 13
May be it helps someone....

How to show the Now Playing Tab in CarPlay?

I'm working on an app that will support CarPlay.It's an audio app.
I'm able to show 2 tabs (favourite and recommended) though I just don't know how to show the Now Playing Tab. I just cannot find any info regarding this.
Do I have to manually show it, and the, how do I push? Do I have to do it manually? If so, what's the viewcontroller?
Thanks.
For the Transition to the Now Playing tab to work on both the simulator and an actual car, you need to make sure to
call beginReceivingRemoteControlEvents on the current UIApplication, and
set a nowPlayingIdentifier on the MPPlayableContentManager
before calling the completion handler in playableContentManager:initiatePlaybackOfContentItemAtIndexPath:completionHandler:.
I know this post is a couple months old, but for me, I had to test in an actual device with CarPlay. Apple says always test it on an actual device with CarPlay. At first, I didn't see a Now Playing tab in the simulator, but as soon as it was tested in a device it was there automatically. I didn't do anything special. I think CarPlay knows when you're playing audio via MPNowPlayingInfoCenter and does this automatically in the actual CarPlay device.

Does the AdInsterstitialAd no longer work with iOS 7?

I have an iPad application where I have integrated the AdInsterstitialAd but it looks like the delegate method:
-(void)interstitialAdDidUnload
is no longer called when closing the ad in iOS 7. I wanted to know if anyone else has experienced this issue or has found away around this? The unload method is important for me because that is when I want to resume my app's timers (the app pauses itself while the ad is displayed).
I have looked on Apple's website and haven't found anything useful and their current InterstitialAd sample has the same issue.

How do I shut down OpenGL tasks in applicationWillResignActive?

I have nearly completed my first app. In testing on the device, I am getting a crash when I press the home button, with the error message
libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
Based on these posts:
https://stackoverflow.com/search?q=how+to+shut+down+OpenGL
OpenGL ES crash on move background, iOS 5.1
I am pretty sure the problem is that my app is an extension of software that uses some sample code involving OpenGL (about which I have very little understanding) and that the OpenGL tasks are not shutting down properly on resignActive.
I tried the following in my AppDelegate with no luck:
- (void)applicationWillResignActive:(UIApplication *)application {
glFinish();
}
My app does not need to save any settings upon exit... it just needs to end.
Can anyone suggest a solution?
I am now working on a Sprite Kit game and I had a similar problem.
Check if you have on the screen the node that tells the FPS, because that might be rendering and causing the crash.. It did for me.
In applicationWillResignActive method I call my pause method as all of you.
*edit - and check for audio playing
To finish program at user push home button ?
on Xcode, choice Target and select Info tab.
Custom iOS Target Properties, add a Key named
Application does not run in background
and set Value
YES
Try it!
p.s. Not necessary write glFinish().

Resources