Group Group Group Group Group Group Group Group Group

tvOS Apprentice 2nd ed. not XCode8/tvOS10 compatible (page 87, ch4)

  1. At the top of page 87 (chapter4) there is a picture of the ‘cool header you’ve created’ which consists of a main image, a title, and a subtitle. I have not been able to get the image to display (the title and subtitle appear) and always get an error log with the last entry saying:
    [wenderTV] ImageIO: _IIOImageDestinationCreateWithURL:2459: utType parameter is nil

When I open the source code downloaded from raywenderlich.com, it shows that the Project Format is ‘Xcode 3.2-compatible’. I have been changing that to ‘Xcode 8.0-compatible’ as written on the outside of the book [the second edition was updated for iOS10, Xcode 8 & Swift 3]. I have Xcode 8.2, the current version, and tvOS 10.1.

  1. When I run the chapter 4 starter project as downloaded, it appears to work but I get lots of error messages in the console - 49 lines of errors (leaving it as downloaded with format Xcode3.2). When I add the few changes at the beginning of chapter 4 from page 81 to 84 it appears to run OK but I get lots of debug errors. When I change the code from page 85 to 86, I still get lots of errors, but can’t get the background image to appear. When I run the chapter 4 final code as downloaded, I still get lots of error messages, but it appears to work.

For a book which is trying to teach programming, I am surprised at the errors generated. I would expect there to be no errors from code downloaded directly from the website. I presume that there were no errors when it was originally tested for previous versions.

[Edit: For point 1) summary of my following posts is that the image background is a .lsr file which Xcode itself can’t display and neither can the generated tvOS code. There is no problem with the .lsr file itself which opens cleanly in Parallax Previewer. Maybe an Apple problem?]

When I run the code as downloaded for the start of chapter 4, I get 54 lines of error in the log as shown below (Xcode 8.3.2).
The first 8 lines are noting that some classes are defined in 2 places and which implementation is used is undefined. These are warnings and can be ignored.
There is one further warning on line 30 about an animation opacity which can also be ignored, although good coding should not produce this warning.
The remaining 45 lines are errors about files, connections and caches not being read. In exemplar code used to educate, I am surprised at this.

The full log is:
\f0\b\fs22 \cf2 \CocoaLigature0 objc[12591]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x11616bf38) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x115cfcc98). One of the two will be used. Which one is undefined.
objc[12591]: Class ATVAuthenticationContext is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVContentPartnerKitUI.framework/TVContentPartnerKitUI (0x10aebf340) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/TVServices.framework/TVServices (0x10ad38c28). One of the two will be used. Which one is undefined.
objc[12591]: Class TVPlaybackProgressAnimation is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVPlayback.framework/TVPlayback (0x10abd2850) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98cee0). One of the two will be used. Which one is undefined.
objc[12591]: Class _TVDigitView is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98ef38) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVSystemUI.framework/TVSystemUI (0x10703a440). One of the two will be used. Which one is undefined.
objc[12591]: Class _TVFlatIconCache is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98ddb8) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVSystemUI.framework/TVSystemUI (0x10703ac38). One of the two will be used. Which one is undefined.
objc[12591]: Class _TVDestructiveTextAlertButton is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98d110) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVSystemUI.framework/TVSystemUI (0x10703acb0). One of the two will be used. Which one is undefined.
objc[12591]: Class _TVInitialFocusButton is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98d160) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVSystemUI.framework/TVSystemUI (0x10703ad00). One of the two will be used. Which one is undefined.
objc[12591]: Class _TVFocusableView is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVKit.framework/TVKit (0x10a98d1b0) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/TVSystemUI.framework/TVSystemUI (0x10703ad50). One of the two will be used. Which one is undefined.
2017-04-26 18:34:52.058 wenderTV[12591:1362200] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.058 wenderTV[12591:1362200] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.059 wenderTV[12591:1362200] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.060 wenderTV[12591:1362200] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.060 wenderTV[12591:1362205] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.060 wenderTV[12591:1362200] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.060 wenderTV[12591:1362205] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.061 wenderTV[12591:1362200] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.061 wenderTV[12591:1362205] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.062 wenderTV[12591:1362200] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.062 wenderTV[12591:1362200] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.063 wenderTV[12591:1362200] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.386 wenderTV[12591:1362195] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.387 wenderTV[12591:1362195] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.388 wenderTV[12591:1362195] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.391 wenderTV[12591:1362244] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.391 wenderTV[12591:1362247] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.391 wenderTV[12591:1362247] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.391 wenderTV[12591:1362244] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.392 wenderTV[12591:1362244] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.392 wenderTV[12591:1362247] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.542341+0100 wenderTV[12591:1361998] [Warning] <UIVisualEffectView 0x7fa21f73a8f0> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1.
2017-04-26 18:34:52.655 wenderTV[12591:1362244] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.656 wenderTV[12591:1362244] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.656 wenderTV[12591:1362244] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.882 wenderTV[12591:1362240] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.882 wenderTV[12591:1362240] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.883 wenderTV[12591:1362240] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.904 wenderTV[12591:1362241] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.905 wenderTV[12591:1362241] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.905 wenderTV[12591:1362241] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.942 wenderTV[12591:1362240] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.942 wenderTV[12591:1362240] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.943 wenderTV[12591:1362240] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.945 wenderTV[12591:1362195] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.945 wenderTV[12591:1362195] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.945 wenderTV[12591:1362195] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:52.948 wenderTV[12591:1362240] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:52.948 wenderTV[12591:1362240] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:52.948 wenderTV[12591:1362240] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:53.039 wenderTV[12591:1362247] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:53.039 wenderTV[12591:1362247] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:53.040 wenderTV[12591:1362247] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
2017-04-26 18:34:53.048 wenderTV[12591:1362240] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db. Error=14. Cause=unable to open database file
2017-04-26 18:34:53.048 wenderTV[12591:1362240] CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
2017-04-26 18:34:53.048 wenderTV[12591:1362240] Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2\

[Edit: Xcode version specified]

When I take the Chapter 4 startup code as downloaded, and add the changes up to the end of page 86 as mentioned in the first post, in the latest Xcode8.3.2 I get a similar log file to the one above, i.e. 8 lines of multiple class definitions warnings, 1 line of animation opacity warning, and some lines of file, connection and cache errors, although a few less of these since the homeScreen now has much less content.
But, as mentioned in the original post, I don’t get the result at the top of page 87 because the image is missing from each of the three headers.

When I re-run exactly the same code in Xcode 8.2, I get the same visual output (missing images in the headers), but the log is different in that 7 of the lines of multiple class definitions are missing, and I get an extra 5 lines at the end reporting that the ‘utType parameter is nil’ as reported in my first post.

So the code is not working in both Xcode 8.2 and Xcode 8.3.2, but the log reports say different things.

In the file homescreen.json, the image in all three of the headers is the same: rwdevcon-featured.lsr. If I select that file in the Xcode hierarchy, it is not displayed but sticks at ‘loading’. If I select another image file such as image-feature-banner.png then Xcode will display it.
In homescreen.json, if I replace the reference to rwdevcon-featured.lsr by a png file that I have added to the project, then the background is properly loaded and I get the result as required at the top of page 87.
So it seems that the problem is probably the .lsr type file. This is worrying since .lsr files are specifically designed for tvOS, but Xcode and the running application seem to have some problems with them in certain situations.