ChromeCast in iOS using swift - ios

I am trying to add Chromecast in my iOS app. I have installed google cast pod file and integrate the google cast developer console.Now when I tried with the GCKUICastButton in my screen, after tapping the button for first time the button is diss appearing and facing a error in console
"Message from Chromecast = Failed to search for net services with error dictionary {NSNetServicesErrorCode = "-72008";NSNetServicesErrorDomain = 10;}"
let discoveryCriteria = GCKDiscoveryCriteria(applicationID: appId)
let castOptions = GCKCastOptions(discoveryCriteria: discoveryCriteria)
GCKCastContext.setSharedInstanceWith(castOptions)
GCKLogger.sharedInstance().delegate = self
Wrote this code in app delegate, still unable to solve the issue. any help much appreciated.

Related

Spotlight search not working for mac catalyst apps

I've an iOS app that has spotlight search feature which allows user to search items from an app. It works fine on iOS app
I am in the process of migrating the app as a catalyst app, somehow the spotlight search on mac catalyst app is not working
So far following things have been checked
Spotlight search logic is working as expected, there are no errors
Restarted Mac
Open catalyst app multiple times just to check if it is syncing with core spotlight and it is.
No previous issues registered on stack-overflow
Env: macOS 12.0.1
P.S: I am unsure if it is related to specific to my code as it is working fine on iPad and iPhone devices.
let attributeSet = CSSearchableItemAttributeSet(contentType: .content)
attributeSet.title = decodeItem.name
attributeSet.relatedUniqueIdentifier = decodeItem.id
attributeSet.url = URL.init(string: decodeItem.url)
let searchableItem = CSSearchableItem(uniqueIdentifier: decodeItem.id,
domainIdentifier: "com.xxx.xxxx",
attributeSet: attributeSet)
searchableItems.append(searchableItem)
CSSearchableIndex.default().indexSearchableItems(searchableItems) { error in
if let error = error {
print("Issue indexing: \(error)")
} else {
print("Indexed.")
}
}
Found the issue: Assign value to attributeSet.relatedUniqueIdentifier only from initializer

How to trigger PER-APP-VPN using NEVPNManager class in iOS using Swift4

I need your some efforts, for helping me to resolve this PER-APP-VPN issue.
Problem Statement : My app is unable to invoke PER-APP-VPN, while opening app.
Description :
I've deployed my app on MDM i.e supervised device. Whenever I open my app, it doesn't trigger PER-APP-VPN connection automatically.
What did I tried:
For this I've written below code...this is just I've done for demo purpose. But still not working.
let status=NEVPNManager.shared().connection.status
print(status)
}
let manager = NEVPNManager.shared()
let result = NEOnDemandRuleConnect()
result.interfaceTypeMatch = .any
manager.onDemandRules = [result]
manager.isOnDemandEnabled = true
manager.isEnabled = true
manager.saveToPreferences()
self.vpnStatus.text = manager.connection.status.rawValue == 1 ? "VPN Connected" : "VPN Not Connected"
Scenario:
I've corporate VPN. And I'm deploying app on corporate / work supervised device. I've deployed app on Blackberry EMM Solution.
So, I've assigned PER-APP-VPN profile. But still it is not invoking VPN connection automatically.

Opentok black screen issue

I am using Opentok code for my swift program.
I have two questions.
1) I use same session in my two UIViewcontrollers.
Once I open my connection with the session, should I close it before opening /connecting it in the second page?
2) sometime I am getting black screen insead of subscribers video. I use the static session created in the trial version.
Please advice.
var error: OTError? = nil
session.disconnect(error)
if error != nil {
print("disconnect failed with error: (\(error))")
}
session(session, streamDestroyed: stream)

Is there are way to open an iMessage extension from within the container app?

So far I've been encountering scenarios where you can launch the embedding app from the extension using the openURL: method, but is there a way to achieve the opposite?
I'm interested in knowing whether it would be possible to do something in my container app that creates an MSMessage instance and launches my iMessage app extension. Is this doable?
If anyone else is interested, as of Xcode 8.0 beta 6, MFMessageComposeViewController declares a property message of type MSMessage that lets you create an interactive message from within a springboard application so it can be used to achieve what I wanted in the first place. It does not, however, let you open a container app application.
Here's my code:
let message = MSMessage()
message.url = // Your message url
message.layout = MSMessageTemplateLayout()
message.summaryText = // Summary text
let messageViewControler = MFMessageComposeViewController()
messageViewControler.message = message
show(messageViewControler, sender: self)
Unfortunately, this is not currently possible. You can read it in this thread: https://forums.developer.apple.com/thread/50375

Application crashes when trying to send mail with MFMailComposeViewController

I am trying to send an email from within my iOS app using MFMailComposeViewController.
var mailhelp: MailComposerHelper? = nil
self.mailhelp = MailComposerHelper(fileName: self.currentObject.name as String, fileToSend: self.currentObject.lpath as String,sName: self.sName! as String)
self.mailhelp!.mailComposeDelegate = self
self.presentViewController(self.mailhelp!, animated: true, completion: nil)
The application crashes on this line:
self.mailhelp!.mailComposeDelegate = self
with:
fatal error: unexpectedly found nil while unwrapping an Optional value
Trying to print anything from within the mailhelp object, shows nil.
What's odd is that the app was already in use for some time now and this was tested and was working just fine just about 1 month or so ago. When I fired the app today, it crashed. Tried on all iOS devices, same thing. And I don't recall updating those devices recently or making any other change that might cause any issues.
Any thoughts? Also, has anyone encountered any similar issues (an app that start crashing out of the blue)?

Resources