Hi RobNotYou,
Thank you for your fast response. Do you mean there is no way literally to implement it, or if I used this kind of code part,
then it would not be approved for Apple Store?
Thanks a lot in advance.
Post
Replies
Boosts
Views
Activity
Hi Claude31,
I have done some researches and saw these discussion:
https://stackoverflow.com/questions/41512552/avcapturedevice-isinusebyanotherapplication-always-returns-false
I guess this explanation in the discussion:" key word is exclusive. The camera can only be exclusively locked via lockForConfiguration, and that's only temporary. So, multiple apps can use the camera at the same time." shows that this method`s output is not exactly what I need. Am I right? I am not trying to detect if any app locks the camera, I am trying to find if any application is using the camera currently. Ex: A command like "lsof | grep VDC" in macOS, which provides similar output.
Do you have another idea?
Thanks a lot in advance.
Best Regards
Emre
By the way, I just saw that, IOS does not support isinusebyanotherapplication method
https://developer.apple.com/documentation/avfoundation/avcapturedevice/1389512-isinusebyanotherapplication
Hi OOPer, sure. I can add it next time. So is it impossible to check camera status in IOS?
Thanks a lot for the fast response.
1-Yes I mean Xcode folders. Somehow I cannot attach screenshots to this conversation, but if you need you can see my Xcode folder structure from my dropbox:
https://www.dropbox.com/s/32pvvb0o90hli5x/Screenshot%202022-01-14%20at%2012.03.58.jpg?dl=0
2-Check that delegate is not nil:
2.1. you are right, it is nil. I set a breakpoint to "delegate?.didOutput(pixelBuffer: imagePixelBuffer)" line and debugger showed me following output:
delegate BroadcastExtension.SampleHandlerDelegate? nil none
2.2 How should I initialise it in a right way?
I declared in SampleHandler: weak var delegate: SampleHandlerDelegate? and initialised in ViewController:
override func viewDidLoad() {
sampleHandler.delegate = self
}
3-print(#function) did not print anything, with the reason that I cannot call didOutput method from ViewController
Thanks a lot in advance.
I am so sorry. there was copy paste failure(the last } should move above extension ViewController: SampleHandlerDelegate ). it was already outside of my class.
I guess it will be easier if I share my whole project(ReplayKitExample.xcworkspace), I recognised that my files had also different targets. I guess this could also be a problem that my delegate has nil value?
ViewController is under ReplayKitExample folder
SampleHandler is under BroadcastExtension folder
https://www.dropbox.com/s/ae9u44rsh1vg4uj/ios.zip?dl=0
Ok. You are right. My Target Memberships can be the problem. ViewController has membership of my App target, SampleHandler has membership of my App target and Broadcastextension. Do you know how I can call a method from ViewController in SampleHandler?
Thanks a lot in advance