Search results for

“SwiftData inheritance relationship”

4,983 results found

Post

Replies

Boosts

Views

Activity

Audio Unit Extensions using other audio units
I'm looking into how to package an Audio Unit consisting of several other audio units. I came up with the following solution, calling the AUAudioUnit render function explicitly from the AUInternalRenderBlock. But the audio unit doesn't seem to run, since mData inside outputData remains uninitialized after the render function has been triggered.Any suggestions?From myAudioUnit.m inheriting from AUAudioUnit:- (AUInternalRenderBlock)internalRenderBlock { return ^AUAudioUnitStatus(AudioUnitRenderActionFlags *actionFlags, const AudioTimeStamp *timestamp, AVAudioFrameCount frameCount, NSInteger outputBusNumber, AudioBufferList *outputData, const AURenderEvent *realtimeEventListHead, AURenderPullInputBlock pullInputBlock) { [_eqAudioUnit.audioUnit renderBlock](actionFlags, timestamp, frameCount, outputBusNumber, outputData, pullInputBlock); return noErr; }; }_eqAudioUnit is an instance of EQAudioUnit (ensuring that allocateRenderResources is invoked before triggering the renderBlock):public class EQAudioUni
0
0
591
Sep ’16
Reply to Having problems with self
The problem arises because you're using a closure (block of commands) in the SKAction that you're creating as the initial value of the SEQ instance variable. However, at the time this initial value is set, the value of 'self' is not yet available. (You can't refer to 'self' until the object has finished its initialization, and setting SEQ is part of that initialization. Catch-22.)Your larger problem is that you're doing things kinda inside out. You're trying to pass the object instance (self) into functions, instead of writing the behavior as methods of the object. These contortions are probably as a result of trying to convert your Lua script, instead of thinking in terms of how the pieces of an actual app fit together.I suggest you start with an Xcode Sprite Kit game template (for the appropriate platform), and examine the relationships it defines for you, between the view controller, the view, and the scene. The hierarchy it uses is what's natural for this kind of app.In particular, it's likely to
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Sep ’16
Reply to IsPaused bug
If it's any consolation, and I know it's probably not, I sent a critique of the new docs format a few weeks back. The new docs format is a very bad joke.Too much white space. No logical ordering of anything. No simply referencing to pertinent and and relevant others. The inheritance and traits are at the bottom of each page, uses Symbol like a Ruby programming nodding to the fact Swift is compiled, most everything is incomplete, there's no examples of how to use anything, etc etc.Response:Expected Behaviour.Oh... joy!
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Sep ’16
Compiler Incorrectly Warns when declaring a delegate property that conforms to a protocol which inherits from a protocol
So, I have a subclass of NSTableView. I extend NSTableViewDelegate. My interface looks something like this:@protocol MyTableViewDelegate; @interface MyTableView : NSTableView @property (nullable,weak) id <MyTableViewDelegate> delegate; @end @protocol MyTableViewDelegate <NSTableViewDelegate> //Added methods here... @endNow this always would warn, but not if you used @dynamic to acknowledge intent:@implementation MyTableView @dynamic delegate; @endBut now the warning is always present in Xcode 8
1
0
231
Sep ’16
Reply to Find out app store.
When user downloads the application from app store, I want to find out from which app store user has downloaded that application.AFAIK there’s no supported way to do this.To use the current locale of the user to detect in which country they are …Don’t do that. There’s no guaranteed relationship between between language (or locale) and the App Store country. For example, when visiting my family in Australia I may need to switch to the AU store to get AU-specific apps, but my device’s language and locale will still be based on where I live.You may get recommendations to do this by looking at undocumented fields in the app’s App Store receipt. That’s also a bad idea. Anything receipt field that’s not explicitly documented in the Receipt Validation Programming Guide is off limits.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: General Tags:
Sep ’16
Camera UI frozen after nav pop
This is on an iPhone6 running iOS10 compiled with XCode 8 in Swift 3 codebase (the only configuration tested so far).My app presents a UIImagePickerController modally, in camera mode. After user takes a picture and taps Use Photo, I push a custom image cropping view controller onto the picker (since it inherits from UINavigationViewController). This works fine, but if the user then pops back to the camera view, the camera UI is completely frozen. It still displays the last (static) image and the Retake and Use Photo buttons, but the UI is dead.The only configuration to the default camera is `showCameraControls` is true.Is this a bug, or do I need to restart the camera UI somehow? I'd really prefer not to dismiss the modal just to present the cropper (possibly reversing this if they want to go back), as the push transition is really the right convention here. I've seen posts to the effect that dismissing the camera and opening a new modal tends to work and that the camera only works once but this seem
0
0
1.1k
Sep ’16
NSFetchedResultsController returns duplicates (the same objectID and reference)
I'm experiencing a weird behaviour with NSFetchedResultsController. It is new in iOS 10. Straight to the point: `fetchedObjects` contains duplicate objects.This is not by any mean duplicate in my own criteria. They literally have the same objectIDs and the same reference.How does it happen in my app:FRC is setup and fetch performed2 objects are fetched (in this example)Something happens in my sync layer, another object (that fetch items are in relationship with) is updatedFRC calls delegate that the content did change. `fetchedObjects` contains 4 objects (2 duplicates)Here's a console output from my debugging in `controllerDidChangeContent` method. po frc.fetchedObjects - 0 : <ListItem: 0x1700dc3f0> (entity: ListItem; id: 0x1706294a0 <x-coredata://12D0CB00-7BF4-402A-8371-19DD1CFB1537/ListItem/t3384FC2D-3399-41FE-B7DD-C277922F495445> ; data: { ... } - 1 : <ListItem: 0x1700dc3f0> (entity: ListItem; id: 0x1706294a0 <x-coredata://12D0CB00-7BF4-402A-8371-19DD1CFB1537/ListItem/t3384FC2
0
0
785
Sep ’16
Reply to Can't see variable values in inner block
One thing I’ve been bitten by previously is bogus build settings inherited from the deep past of my project (see this thread). That’s why it’s good to test this stuff with a new project, which is what I did.Specifically, I created a new command line tool project and set main.swift to be the following: func f(_ i: Int, _ j: Int) -> Int { return i * j } func somefunc(_ i: Int) -> Double { return Double(i * 2) } class myclass { func a(arg: Int) -> Double { var sum = 0.0 for i in 0 ..< 100 { let val = f(i, arg) sum += somefunc(val) } return sum } } print(myclass().a(arg: 5))A breakpoint at line 15 shows reasonable values for arg, sum, i and val. Please try this yourself to see if you can replicate my results.This was with Xcode 8.0 btw.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Sep ’16
Reply to Beware, CKShare can only be used to share a few hundred records
Sharing works with hundreds of thousands of records in our test environment but only if you create the CKShare before creating this many child records to the parent record.But this does not seem to be a Apple-sanctioned way - you should create a share shortly before you invite the first CKParticipant to the share. In this case, the CKShare can only be created if 5.000 or less records are assigned to the root record (it does not seem to matter if the parent/child relationships are a hierarchy or just a flat list with a parent records and 5.000 childs).We could add or remove participants and other users were able to accept the CKShare.It seems that the 5.000 records is the hard limit when creating the CKShare. Adding the records afterwards currently works but it is up to Apple when or if a limit will be enforced. Sadly, we got no word on that.We are, too, desperately looking for a workaround. 😟 Please make sure that you are creating a feature request for this issue: https://bugreport.apple.com
Sep ’16
How to start ReplayKit screen recording in SpriteKit SKScene class?
I have implemented ReplayKit in my SpriteKit game, but since everything is done within the GameViewController the record button appears too early. Please see my GameViewControllerclass below:class GameViewController: UIViewController, RPPreviewViewControllerDelegate{ var videoRecButton: UIButton! var videoRecImage: UIImage! override func viewDidLoad() { super.viewDidLoad() let skView = self.view as? SKView if skView?.scene == nil { skView?.showsFPS = true skView?.showsNodeCount = true skView?.showsPhysics = true skView?.ignoresSiblingOrder = false let posterScene = PosterScene(size: skView!.bounds.size) posterScene.scaleMode = .aspectFill skView?.presentScene(posterScene) } videoRecButton = UIButton(type: .custom) videoRecImage = UIImage(named:videoRecButton.png) videoRecButton.frame = CGRect(x:0, y: 0, width: (videoRecImage?.size.width)!, height: (videoRecImage?.size.height)!) videoRecButton.setImage(videoRecImage, for: .normal) videoRecButton.addTarget(self, action:#selector(self.videoRecButtonClicked), for
0
0
621
Oct ’16
Sierra Notification Center Widgets
Notification Center in Sierra has a new, light background colour compared with Yosemite and El Cap. My widget, however, still shows the old, dark style, even when I rebuild with the new SDK.The view has appearance set to Inherited (Vibrant Dark). Changing that to Aqua seems to have no effect.Is it possible to change third party widgets to look the same as Apple's? I notice all the other third party widgets I look the same. Thanks,Stephen
Topic: UI Frameworks SubTopic: AppKit Tags:
4
0
789
Oct ’16
Reply to Error in NSMutableDictionary setObject processing (after updating to iOS10)
The question that remains, is that for the first time error in iOS10.The relationship between Foundation’s NSDictionary and Core Foundation’s CFDictionary (and now Swift’s Dictionary) is a long and complex one. Depending on how that pans out, some immutable dictionaries will detect mutation and some won’t. For example, for a long time the implementation of CFDictionary did not support immutability; internally, all dictionaries were mutable.Moreover, this is not just limited to the behaviour of these low-level frameworks. Sometimes high-level frameworks use a mutable dictionary as a working object and return that to the caller, and sometimes the do that work in an immutable dictionary. Imagine if version 1 of a framework has code like this:- (NSDictionary *)someProperty { NSMutableDictionary * result = [[NSMutableDictionary alloc] init]; result[@a] = @1; result[@b] = @2; return result; }And in version 2 it gets updated to this:- (NSDictionary *)someProperty { return @{ @a: @1, @b: @2 }; }Both are corr
Topic: Programming Languages SubTopic: General Tags:
Oct ’16
calling a convenience initializer from subclass
HiI know a convenience intializer should eventually call a designated initilizer in the same class. But is there a way to use superclass's convenience initilizer in a subclass? I inherited a subclass from class XMLParser, which is a foundation class, I do not know how to override/custom the superclass's initilizer.
3
0
1.5k
Oct ’16
Audio Unit Extensions using other audio units
I'm looking into how to package an Audio Unit consisting of several other audio units. I came up with the following solution, calling the AUAudioUnit render function explicitly from the AUInternalRenderBlock. But the audio unit doesn't seem to run, since mData inside outputData remains uninitialized after the render function has been triggered.Any suggestions?From myAudioUnit.m inheriting from AUAudioUnit:- (AUInternalRenderBlock)internalRenderBlock { return ^AUAudioUnitStatus(AudioUnitRenderActionFlags *actionFlags, const AudioTimeStamp *timestamp, AVAudioFrameCount frameCount, NSInteger outputBusNumber, AudioBufferList *outputData, const AURenderEvent *realtimeEventListHead, AURenderPullInputBlock pullInputBlock) { [_eqAudioUnit.audioUnit renderBlock](actionFlags, timestamp, frameCount, outputBusNumber, outputData, pullInputBlock); return noErr; }; }_eqAudioUnit is an instance of EQAudioUnit (ensuring that allocateRenderResources is invoked before triggering the renderBlock):public class EQAudioUni
Replies
0
Boosts
0
Views
591
Activity
Sep ’16
Reply to Having problems with self
The problem arises because you're using a closure (block of commands) in the SKAction that you're creating as the initial value of the SEQ instance variable. However, at the time this initial value is set, the value of 'self' is not yet available. (You can't refer to 'self' until the object has finished its initialization, and setting SEQ is part of that initialization. Catch-22.)Your larger problem is that you're doing things kinda inside out. You're trying to pass the object instance (self) into functions, instead of writing the behavior as methods of the object. These contortions are probably as a result of trying to convert your Lua script, instead of thinking in terms of how the pieces of an actual app fit together.I suggest you start with an Xcode Sprite Kit game template (for the appropriate platform), and examine the relationships it defines for you, between the view controller, the view, and the scene. The hierarchy it uses is what's natural for this kind of app.In particular, it's likely to
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Sep ’16
Reply to IsPaused bug
If it's any consolation, and I know it's probably not, I sent a critique of the new docs format a few weeks back. The new docs format is a very bad joke.Too much white space. No logical ordering of anything. No simply referencing to pertinent and and relevant others. The inheritance and traits are at the bottom of each page, uses Symbol like a Ruby programming nodding to the fact Swift is compiled, most everything is incomplete, there's no examples of how to use anything, etc etc.Response:Expected Behaviour.Oh... joy!
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Sep ’16
Compiler Incorrectly Warns when declaring a delegate property that conforms to a protocol which inherits from a protocol
So, I have a subclass of NSTableView. I extend NSTableViewDelegate. My interface looks something like this:@protocol MyTableViewDelegate; @interface MyTableView : NSTableView @property (nullable,weak) id <MyTableViewDelegate> delegate; @end @protocol MyTableViewDelegate <NSTableViewDelegate> //Added methods here... @endNow this always would warn, but not if you used @dynamic to acknowledge intent:@implementation MyTableView @dynamic delegate; @endBut now the warning is always present in Xcode 8
Replies
1
Boosts
0
Views
231
Activity
Sep ’16
Reply to UIActivityItemProvider.item should be optional
Hi,since UIActivityItemProvider inherits from NSOperation maybe sending a cancel message to self will do the trick. (Just a wild guess).Dirk
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Sep ’16
Reply to Find out app store.
When user downloads the application from app store, I want to find out from which app store user has downloaded that application.AFAIK there’s no supported way to do this.To use the current locale of the user to detect in which country they are …Don’t do that. There’s no guaranteed relationship between between language (or locale) and the App Store country. For example, when visiting my family in Australia I may need to switch to the AU store to get AU-specific apps, but my device’s language and locale will still be based on where I live.You may get recommendations to do this by looking at undocumented fields in the app’s App Store receipt. That’s also a bad idea. Anything receipt field that’s not explicitly documented in the Receipt Validation Programming Guide is off limits.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’16
Camera UI frozen after nav pop
This is on an iPhone6 running iOS10 compiled with XCode 8 in Swift 3 codebase (the only configuration tested so far).My app presents a UIImagePickerController modally, in camera mode. After user takes a picture and taps Use Photo, I push a custom image cropping view controller onto the picker (since it inherits from UINavigationViewController). This works fine, but if the user then pops back to the camera view, the camera UI is completely frozen. It still displays the last (static) image and the Retake and Use Photo buttons, but the UI is dead.The only configuration to the default camera is `showCameraControls` is true.Is this a bug, or do I need to restart the camera UI somehow? I'd really prefer not to dismiss the modal just to present the cropper (possibly reversing this if they want to go back), as the push transition is really the right convention here. I've seen posts to the effect that dismissing the camera and opening a new modal tends to work and that the camera only works once but this seem
Replies
0
Boosts
0
Views
1.1k
Activity
Sep ’16
Reply to Wink says that Apple won't certify them because they're a Multibrand Platform, is that a disqualifier?
How long/strong is Apple's relationship with one vs. the other?Follow the money...Did you have a question about your own app(s) & HK?Otherwise, we're risking being off-topic for the dev forums, so you may want to move to Apple's public community forums, thanks.Ken
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’16
NSFetchedResultsController returns duplicates (the same objectID and reference)
I'm experiencing a weird behaviour with NSFetchedResultsController. It is new in iOS 10. Straight to the point: `fetchedObjects` contains duplicate objects.This is not by any mean duplicate in my own criteria. They literally have the same objectIDs and the same reference.How does it happen in my app:FRC is setup and fetch performed2 objects are fetched (in this example)Something happens in my sync layer, another object (that fetch items are in relationship with) is updatedFRC calls delegate that the content did change. `fetchedObjects` contains 4 objects (2 duplicates)Here's a console output from my debugging in `controllerDidChangeContent` method. po frc.fetchedObjects - 0 : <ListItem: 0x1700dc3f0> (entity: ListItem; id: 0x1706294a0 <x-coredata://12D0CB00-7BF4-402A-8371-19DD1CFB1537/ListItem/t3384FC2D-3399-41FE-B7DD-C277922F495445> ; data: { ... } - 1 : <ListItem: 0x1700dc3f0> (entity: ListItem; id: 0x1706294a0 <x-coredata://12D0CB00-7BF4-402A-8371-19DD1CFB1537/ListItem/t3384FC2
Replies
0
Boosts
0
Views
785
Activity
Sep ’16
Reply to Can't see variable values in inner block
One thing I’ve been bitten by previously is bogus build settings inherited from the deep past of my project (see this thread). That’s why it’s good to test this stuff with a new project, which is what I did.Specifically, I created a new command line tool project and set main.swift to be the following: func f(_ i: Int, _ j: Int) -> Int { return i * j } func somefunc(_ i: Int) -> Double { return Double(i * 2) } class myclass { func a(arg: Int) -> Double { var sum = 0.0 for i in 0 ..< 100 { let val = f(i, arg) sum += somefunc(val) } return sum } } print(myclass().a(arg: 5))A breakpoint at line 15 shows reasonable values for arg, sum, i and val. Please try this yourself to see if you can replicate my results.This was with Xcode 8.0 btw.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Replies
Boosts
Views
Activity
Sep ’16
Reply to Beware, CKShare can only be used to share a few hundred records
Sharing works with hundreds of thousands of records in our test environment but only if you create the CKShare before creating this many child records to the parent record.But this does not seem to be a Apple-sanctioned way - you should create a share shortly before you invite the first CKParticipant to the share. In this case, the CKShare can only be created if 5.000 or less records are assigned to the root record (it does not seem to matter if the parent/child relationships are a hierarchy or just a flat list with a parent records and 5.000 childs).We could add or remove participants and other users were able to accept the CKShare.It seems that the 5.000 records is the hard limit when creating the CKShare. Adding the records afterwards currently works but it is up to Apple when or if a limit will be enforced. Sadly, we got no word on that.We are, too, desperately looking for a workaround. 😟 Please make sure that you are creating a feature request for this issue: https://bugreport.apple.com
Replies
Boosts
Views
Activity
Sep ’16
How to start ReplayKit screen recording in SpriteKit SKScene class?
I have implemented ReplayKit in my SpriteKit game, but since everything is done within the GameViewController the record button appears too early. Please see my GameViewControllerclass below:class GameViewController: UIViewController, RPPreviewViewControllerDelegate{ var videoRecButton: UIButton! var videoRecImage: UIImage! override func viewDidLoad() { super.viewDidLoad() let skView = self.view as? SKView if skView?.scene == nil { skView?.showsFPS = true skView?.showsNodeCount = true skView?.showsPhysics = true skView?.ignoresSiblingOrder = false let posterScene = PosterScene(size: skView!.bounds.size) posterScene.scaleMode = .aspectFill skView?.presentScene(posterScene) } videoRecButton = UIButton(type: .custom) videoRecImage = UIImage(named:videoRecButton.png) videoRecButton.frame = CGRect(x:0, y: 0, width: (videoRecImage?.size.width)!, height: (videoRecImage?.size.height)!) videoRecButton.setImage(videoRecImage, for: .normal) videoRecButton.addTarget(self, action:#selector(self.videoRecButtonClicked), for
Replies
0
Boosts
0
Views
621
Activity
Oct ’16
Sierra Notification Center Widgets
Notification Center in Sierra has a new, light background colour compared with Yosemite and El Cap. My widget, however, still shows the old, dark style, even when I rebuild with the new SDK.The view has appearance set to Inherited (Vibrant Dark). Changing that to Aqua seems to have no effect.Is it possible to change third party widgets to look the same as Apple's? I notice all the other third party widgets I look the same. Thanks,Stephen
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
4
Boosts
0
Views
789
Activity
Oct ’16
Reply to Error in NSMutableDictionary setObject processing (after updating to iOS10)
The question that remains, is that for the first time error in iOS10.The relationship between Foundation’s NSDictionary and Core Foundation’s CFDictionary (and now Swift’s Dictionary) is a long and complex one. Depending on how that pans out, some immutable dictionaries will detect mutation and some won’t. For example, for a long time the implementation of CFDictionary did not support immutability; internally, all dictionaries were mutable.Moreover, this is not just limited to the behaviour of these low-level frameworks. Sometimes high-level frameworks use a mutable dictionary as a working object and return that to the caller, and sometimes the do that work in an immutable dictionary. Imagine if version 1 of a framework has code like this:- (NSDictionary *)someProperty { NSMutableDictionary * result = [[NSMutableDictionary alloc] init]; result[@a] = @1; result[@b] = @2; return result; }And in version 2 it gets updated to this:- (NSDictionary *)someProperty { return @{ @a: @1, @b: @2 }; }Both are corr
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’16
calling a convenience initializer from subclass
HiI know a convenience intializer should eventually call a designated initilizer in the same class. But is there a way to use superclass's convenience initilizer in a subclass? I inherited a subclass from class XMLParser, which is a foundation class, I do not know how to override/custom the superclass's initilizer.
Replies
3
Boosts
0
Views
1.5k
Activity
Oct ’16