Post

Replies

Boosts

Views

Activity

Core Data NSSecureCoding Problem
My iOS 13.2 Swift app is a type of SceneKit editor which uses Core Data to persist user edits. I'm wondering if Core Data might be associated with the message below since NSManagedObject is a subclass of NSObject and since a test app I created without Core Data does not cause the message to be displayed.Although I haven't subclassed any SceneKit classes which support NSSecureCoding, and no other classes in the app use NSSecureCoding, the following message is displayed when a SCNScene is displayed in a SCNView:[general] NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject.This message is displayed only once even though a SCNScene can be reopened multiple times to reflect the user's edits. Possible Causes1. Some of the Core Data entities contain binary data properties used to display thumbnail images. However, when I comment-out the code associated with creating/displaying the thumbnails, the above message is still displayed. The thumbnail data is created with the following code which returns an optional data object. I wonder about this, because Swift bridges to NSData which is a subclass of NSObject.static func createNonCachedItemThumbnailData(item: Item) -> Data? { let appDelegate = UIApplication.shared.delegate as! AppDelegate let dataSource = appDelegate.dataSource guard let selectedDesign = dataSource.selectedDesign else { return nil } let resourceSubdirectoryName = selectedDesign.uniqueID! guard let bundleURL = Bundle.main.url(forResource: item.uniqueID!, withExtension: "png", subdirectory: resourceSubdirectoryName + ".scnassets") else { return nil } guard let imageSource = CGImageSourceCreateWithURL(bundleURL as CFURL, nil) else { return nil } /* maxDimension is the lesser of the width or height of the UIImageView in ItemSCNNodeSelectionViewCell. */ let maxDimension: CGFloat = 64.0 let options: [NSString: Any] = [ kCGImageSourceThumbnailMaxPixelSize: maxDimension, kCGImageSourceCreateThumbnailFromImageAlways: true] guard let scaledImage = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) else { return nil } return UIImage(cgImage: scaledImage).pngData() }2. One of the Core Data entities uses NSKeyedArchiver/NSKeyedUnarchiver to archive SCNMaterial as binary data. I didn't use the transformable type for this property, because I read that the transformable type doesn't notice changes when the context is saved. This code seems far from the problem, but the compiler may have noticed it.Any help would be appreciated.
1
0
2k
Dec ’19
iPad Pro 11" Crops SCNScene
When I run my iOS 13.2 SceneKit app using the iPad Pro 11" simulator (Version 11.2.1) on Xcode 11.2.1, the scene is cropped on the top and bottom. I'm trying to find the correct way to accomodate the unique aspect ratio of the iPad Pro 11" such that no cropping occurs. Allowing camera control in my app really isn't appropriate.My app allows the SCNView to be zoomed; so my first thought was to check the constraints. The view hierarchy is as follows: A UINavigationController hosts three UIContainerViews. One of the containerViews hosts a UIViewController subclass instance. A UIScrollView's top, bottom, leading and trailing constraints are set to the safe area of that viewController's view. A SCNView's top, bottom, leading and trailing constraints are set to the safe area of the scrollView. The width constraint priority of the SCNView is 1000. The height constraint priority of the SCNView is 250. These settings allow correct display on all simulators except the iPad Pro 11".The only solution that occurs to me is to add a control which allows the camera to be moved on the z-axis. Is there a better solution?Thank you.
1
0
673
Nov ’19
Base.lproj/Base.lproj Storyboard Localization
When I created a new storyboard in my project, I placed it in the Base.lproj folder. Upon localizing the storyboard, I discovered that its path became Base.lproj/Base.lproj. The location for the storyboard is relative to group.Although the new storyboard is available when I localize for a new language, the Base.lproj/Base.lproj seem odd. I cannot find a way to move the storyboard so its path excludes the second Base.lproj in the path. Should I be concerned about this?I'm using Xcode 10.3 and building for iOS 12.4.Thank you.
1
0
1.9k
Sep ’19
Cancel Pause Resume On-Demand Resource
I have everything associate with on-demand resources working correctly in my application with the exception of the ability to cancel, pause or resume downloading ODR content. Using Xcode 9.4.1 with iOS 11.4 target, the cancel, pause, etc. IBAction is called when a tap occurs, but the progress bar continues unabated. The ODR progress observer completes too. I've seen code like this:class ODRManager {var myCollectionRequest: NSBundleResourceRequest?@IBAction func cancelLoadingOnDemandResource(_ sender: UIButton) { guard let myCurrentRequest = myCollectionRequest else { return } myCurrentRequest.progress.cancel() }}But such code doesn't cancel/pause the NSBundleResourceRequest. I found a radar report dated Jan. 12, 2016 indicating the same problem. Is it possible to cancel, pause or resume a NSBundleResourceRequest download? If so, how is it done?Thank you.
8
0
2.5k
Jul ’18