接受本地网络权限后,Google Cast iOS SDK按钮消失 [英] Google Cast iOS SDK button disappear after accepting Local Network Permission
本文介绍了接受本地网络权限后,Google Cast iOS SDK按钮消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试实施CAST SDK.我的意图和我做了以下事情:
- 投射/镜像我的应用程序屏幕.我不想播放任何视频,而只是将应用程序屏幕投射到更大的电视/屏幕上.我了解Airplay,请立即在Google SDK上进行讨论.
- 我用5美元购买了Google Cast开发人员控制台,并在其中创建了一个applicationID.
- 我已经集成了SDK,并实现了CAST按钮,并在Plist和应用程序功能中设置了iOS 14的所有更改.
- 我已更改所有这些内容,并发现所有有关权限的警报:
相关问题在这里:
- https://github.com/googlecast/CastVideos-ios/issues/98
- https://issuetracker.google.com/issues/178424585
有人可以帮助我吗?预先感谢.
解决方案我最好的选择是
- 将NSBonjourServices添加到您的Info.plist中(确保从
- 将NSLocalNetworkUsageDescription添加到您的Info.plist
< key> NSLocalNetworkUsageDescription</key>< string> $ {PRODUCT_NAME}使用本地网络在WiFi上发现支持Cast的设备</string>网络.
I was trying to implement CAST SDK. My intension and i have done the following things :
- Casting/Mirroring my app screen. I don't want to play any video , just screen casting of my app to larger TV/screen. I know about Airplay, please discuss on Google SDK now.
- I have bought Google Cast Developer Console with 5USD and created an applicationID there.
- I have integrated SDK and implement CAST button, set up all changes for iOS 14 in Plist and app capabilities.
- I have changed all these and found all alert of permission as well : https://developers.google.com/cast/docs/ios_sender/ios_permissions_changes
The problem i am facing now :
- On first launch, app shows the cast button , i click on that, SDK displays permission alert/pop up, i accept all.
- After accepting permission , the cast button disappears and never seen to the app even i re-run the app.
- In the delegate method, i see a log : chromecast Message from Chromecast = Invalid network address
My queries is :
- Why the cast button disappears and never seen to the app , any solution ?
- Is it possible to share/mirroring the app screen rather playing videos using iOS CAST SDK ?
- To share screen , do i need to use any other class/API from SDK ? I see no good example on this, seems poor support from the team.
My code is simple here like :
// Appdelegate
class AppDelegate: UIResponder, UIApplicationDelegate, GCKLoggerDelegate {
let kReceiverAppID = kGCKDefaultMediaReceiverApplicationID
let kDebugLoggingEnabled = true
private let appId = "EF819***"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let discoveryCriteria = GCKDiscoveryCriteria(applicationID: appId)
let castOptions = GCKCastOptions(discoveryCriteria: discoveryCriteria)
GCKCastContext.setSharedInstanceWith(castOptions)
GCKLogger.sharedInstance().delegate = self
return true
}
func logMessage(_ message: String, at level: GCKLoggerLevel, fromFunction function: String, location: String) {
// print("Message from Chromecast = \(message)")
}
// In ViewController , imported CASTSDK
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let castButton = GCKUICastButton(frame: CGRect(x: 0, y: 0, width: 24, height: 24))
castButton.tintColor = UIColor.gray
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: castButton)
self.view.backgroundColor = .white
}
The app settings is :
Related problem is here :
- https://github.com/googlecast/CastVideos-ios/issues/98
- https://issuetracker.google.com/issues/178424585
Anyone can help me on this ? Thanks in advance.
解决方案
My best bet would be that either number 2 or 3 from the upgrade docs are malformed.
- Add NSBonjourServices to your Info.plist (make sure you have an underscore(_) before your appId/receiverID from here
<key>NSBonjourServices</key>
<array>
<string>_googlecast._tcp</string>
<string>_ABCD1234._googlecast._tcp</string>
</array>
- Add NSLocalNetworkUsageDescription to your Info.plist
<key>NSLocalNetworkUsageDescription</key>
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
network.</string>
这篇关于接受本地网络权限后,Google Cast iOS SDK按钮消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文