Post

Replies

Boosts

Views

Activity

AVPlayerViewController memory leaks
Hi guys,I am having memory leaks using AVPlayerViewController with iOS 12.4 and XCode 10.3.I built a test to reproduce it.Just create a new project using Single View App template, then use this code in the ViewController.swift override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) DispatchQueue.main.asyncAfter(deadline: .now() + 7.0) { self.playerViewController = AVPlayerViewController() let player = AVPlayer(url: URL(string: "https://wolverine.raywenderlich.com/content/ios/tutorials/video_streaming/foxVillage.m3u8")!) self.playerViewController.player = player NotificationCenter.default.addObserver(self, selector: #selector(self.playerDidFinishPlaying(note:)), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: self.playerViewController.player?.currentItem) self.present(self.playerViewController, animated: true) { player.play() } } } @objc func playerDidFinishPlaying(note: NSNotification) { NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: self.playerViewController.player?.currentItem) self.playerViewController.dismiss(animated: true) }The code presents (with a 7 seconds delay) an AVPlayerViewController with a video url (you can use another one if you prefer) and close it automatically when the video ends. Since the code is in viewDidAppear the process is repeated in loop.The memory leaks appear everytime the AVPlayerViewController is dismissed and memory keeps growing and is never released.The leaks are present even if you don't do the automatic dismiss using the AVPlayerItemDidPlayToEndTime notification.Just add this code to your viewcontroller and dismiss the AVPlayerViewController using the close button.The problem of memory leaks persists.override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { self.playerViewController = AVPlayerViewController() let player = AVPlayer(url: URL(string: "https://wolverine.raywenderlich.com/content/ios/tutorials/video_streaming/foxVillage.m3u8")!) self.playerViewController.player = player self.present(self.playerViewController, animated: true) { player.play() } } }If I am doing something wrong please help me understand what is it.Thank you for your time.Gio
1
0
1.7k
Aug ’19
API for checking Network permissions
Hi guys, I watched the talk about adding support for local network privacy permissions in iOS 14. I can't understand if there is a way to check if user has denied the local network privacy permission. I need it so that when the permission is denied I can suggest the user to enable it in order to use the function in the app. Is there an API I can use or is there any suggestion you have on how to deal with this situation? Thank you. Giohn
1
0
959
Jan ’21
Missing deployment targets in Xcode 12.4
I can't find some of the deployment targets in the General tab however I can add them manually from the Build Settings tab. The missing targets are iOS 12.0, 14.2, 14.0, 13.3, 13.1, 12.2, 12.0 and the list goes on... Do you experience the same problem? I am running Xcode 12.4 on MacOS Catalina 10.15.7 Cheers, Giohn
2
0
2.9k
Feb ’21
Trigger an event when SCNode is near a certain transform.
Hi guys, I'd like to trigger an event, in particular I'd like to load another scene when the camera node transform property is similar to a particular target transform. Is it possible? I thought about computing a distance between the camera transform and my target transform, but I don't know how to compute this distance. Any idea? The measure of similarity does not need to be super precise but it has to be efficient since it has to run at 60fps. Thank you Giohn
2
0
1.2k
Feb ’21
Action extension does not activate for HEIF images
Hi, I am trying to create an action extension for my iOS app. My action extension for now is a simple image viewer, the one of the default action extension template. My problem is that the action extension is working only for jpg images but not for heif images. I am testing this with the Apple's Photos app. This is my plist: keyNSExtension/key dict keyNSExtensionActionWantsFullScreenPresentation/key true/ keyNSExtensionAttributes/key dict keyNSExtensionActivationRule/key dict keyNSExtensionActivationDictionaryVersion/key integer2/integer keyNSExtensionActivationSupportsImageWithMaxCount/key integer1/integer /dict keyNSExtensionServiceAllowsFinderPreviewItem/key true/ keyNSExtensionServiceAllowsTouchBarItem/key true/ keyNSExtensionServiceFinderPreviewIconName/key stringNSActionTemplate/string keyNSExtensionServiceTouchBarBezelColorName/key stringTouchBarBezel/string keyNSExtensionServiceTouchBarIconName/key stringNSActionTemplate/string /dict keyNSExtensionMainStoryboard/key stringMainInterface/string keyNSExtensionPointIdentifier/key stringcom.apple.ui-services/string /dict Do you know how to make it work also for HEIF pictures?
0
0
714
May ’21
Will the final release of XCode 14 support macOS Monterey?
Hi there, do you happen to know if XCode 14 will support macOS 12 Monterey? I can see that its beta release still works with macOS Monterey but what about the final version? I noticed that current release of XCode 13 does not support the previous macOS 11 Big Sur. They dropped support with the update 13.3. Does someone know if it will be the same for XCode 14? Will they initially maintain support for Monterey and then drop support at some point in time?
3
0
2.5k
Aug ’22