I have one query, can we do something like , when our App running at that time only its shows in Third party App like quicktime. When I close my App it Remove from device list of third party App.
I have implemented this that way:
The host app periodically send information about active devices to extension (just JSON format)
Extension checks active devices and adds/removes devices according the list of p. 1
Extension periodically checks the last time the list of active devices was sent and if time interval is more than defined (let's say more that 5 sec), extension removes all devices.
The transport was used to send the list of active devices - custom device property.
The only problem - you should keep one device as "control device". Probably communication is possible using Extension Provider custom properties but I cannot access them from the host app.
Post
Replies
Boosts
Views
Activity
My question is about accessing the custom properties of provider (CMIOExtensionProviderSource).
I have successfully transfer some string data from host app to camera extension using custom properties of the device (CMIOExtensionDeviceSource) but I cannot find the way to access the custom property of Extension Provider (CMIOExtensionProviderSource).
I use this code to set the custom property of the device:
let selector = FourCharCode("keep")
var address = CMIOObjectPropertyAddress(selector, .global, .main)
//deviceId: CMIOObjectID
let exists = CMIOObjectHasProperty(deviceId, &address)
if exists {
var settable: DarwinBoolean = false
CMIOObjectIsPropertySettable(deviceId,&address,&settable)
if settable == false {
return
}
var dataSize: UInt32 = 0
CMIOObjectGetPropertyDataSize(deviceId, &address, 0, nil, &dataSize)
var newCommand: CFString = "command string here" as NSString
CMIOObjectSetPropertyData(deviceId, &address, 0, nil, dataSize, &newCommand)
}
As I understand to set the property of provider I have to pass CMIOObjectId of Provider. I tried to use kCMIOObjectSystemObject, but unsuccessfully.
//To use Extension Provider instead of Control Camera, Provider CMIOObjectId should be passed to CMIOObjectSetPropertyData instead of deviceId
let exists = CMIOObjectHasProperty("ProviderId", &address)
//this doesn't work, exists == false
let exists = CMIOObjectHasProperty(kCMIOObjectSystemObject, &address)
Has someone used CMIOExtensionProviderSource custom properties and can help with that?