tvos

Can I use NSUserDefaults with tvOS?

孤街浪徒 提交于 2019-12-18 03:08:04
问题 The App Programming Guide for tvOS briefly states that There is no persistent local storage for apps on Apple TV. This means that every app developed for the new Apple TV must be able to store data in iCloud and retrieve it in a way that provides a great customer experience. Does this mean NSUserDefaults is unavailable? What mechanisms are available for data storage? 回答1: According to an Apple Staff member on the devforums, you can use NSUserDefaults on tvOS for up to 500 kb of data: https:/

UICollectionViewCell to UIButton Focus in tvOS

☆樱花仙子☆ 提交于 2019-12-18 02:42:20
问题 I have a UICollectionView which contains 12-13 UICollectionViewCells. I can easily focus on the UICollectionViewCells and everything works. There is a UIButton outside the UICollectionView. If I am on the first cell or the second cell and I swipe up then I can easily focus on the UIButton. When I am on the third cell then I am not able to move the focus to the UIButton. Any ideas what is going on? 回答1: You should use a UIFocusGuide that encompasses the UIButton you want to focus. Make the

Opening the Apple TV App Store

不问归期 提交于 2019-12-17 23:23:40
问题 Trying to build a tvOS app and one of the use cases I have is to be able to link off and open another app in the Apple TV App Store directly on a button click. Can someone please share a code snippet to enable this? 回答1: I have figured this out by examining the device console output. The trick is to use the com.apple.TVAppStore scheme instead of itms-apps . Example (Swiss App Store): com.apple.TVAppStore://itunes.apple.com/ch/app/youtube/id544007664?mt=8 In fact, the https scheme is also

How to retrieve iPhone IDFA from API?

大兔子大兔子 提交于 2019-12-17 22:29:28
问题 I would like to get the device IDFA . How to get this info from iOS official API ? 回答1: First of all: #import <AdSupport/ASIdentifierManager.h> If you would like to get it as an NSString, use: [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString] So your code might look like this: NSString *idfaString = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; 回答2: You first have to check if user user has decided to opt out from ad tracking . Only if he

AVPlayer with playback controls of avplayerviewcontroller

时光怂恿深爱的人放手 提交于 2019-12-17 19:18:49
问题 I am putting n avplayer inside of a view controller to customize some other elements of the view controller but I still want the playback and scrubbing controls used in AVPlayerViewController. Is there a way to enable these controls for the Avplayer when I am not using AvPlayerViewcontroller? 回答1: No. The usual solution (explicitly advised by Apple) is to use the AVPlayerViewController as an embedded view controller - i.e., make your view controller a custom parent view controller and the

How to play YouTube content on tvOS

放肆的年华 提交于 2019-12-17 07:08:22
问题 How would one play a YouTube video on Apple tvOS? YouTube's embed feature works in iOS 9 as the OS has a UIWebView we can embed it into. The new tvOS does not include a UIWebView so I cannot see a way to embed the YouTube video. 回答1: UIWebView and MPMoviePlayerController are not available for tvOS. Our next option is to use AVPlayer to play YouTube videos. AVPlayer cannot play a YouTube video from a standard YouTube URL, ie. https://www.youtube.com/watch?v=8To-6VIJZRE . It needs a direct URL

Web app in tvOS

元气小坏坏 提交于 2019-12-17 04:31:52
问题 Apple has released it's SDK for apple tv yesterday. Most apps for TVs are web based (html, javascript and css) and I would like to port an existing tv web app to the tvOS. The SDK in Xcode shows no Webview implementation like in iOS for creating apps based in html, javascript and css, however, according to the docs, it is possible to use javascript using tvjs framework, but instead of html, apple has it's own markup language for TVs called TVML. My question is: Is it possible to port an

Web app in tvOS

这一生的挚爱 提交于 2019-12-17 04:31:20
问题 Apple has released it's SDK for apple tv yesterday. Most apps for TVs are web based (html, javascript and css) and I would like to port an existing tv web app to the tvOS. The SDK in Xcode shows no Webview implementation like in iOS for creating apps based in html, javascript and css, however, according to the docs, it is possible to use javascript using tvjs framework, but instead of html, apple has it's own markup language for TVs called TVML. My question is: Is it possible to port an

Cocoapod pod only for a specified platform

微笑、不失礼 提交于 2019-12-14 01:12:42
问题 I have an Xcode project with multiple targets. One of those targets targets the tvOS platform. My other targets make use of the 'youtube-iso-player-helper' framework, which does not support tvOS. I want to have a Cocoapod Podfile that includes the player framework only on iOS. Here is my current Podfile: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' platform :tvos, '9.0' use_frameworks! pod 'SVGgh' pod "youtube-ios-player-helper", "~> 0.1" xcodeproj 'MyProject.xcodeproj

UITapGestureRecognizer & tvOS remote for Pause/Play Button

喜欢而已 提交于 2019-12-13 19:40:44
问题 I am trying to create an action when a user clicks the pause/play button on the Apple TV Remote. I looked at the documentation, but the code Apple's documentation recommended does not work. Here is my code below. Could someone please tell me what I am doing wrong? Things to consider: I am using an AVPlayerMovieController & I do have another gesture recognizer in my code but for it is a swipe gesture AND this method is getting called, just not the Pause/Play. Can someone please help?