Post

Replies

Boosts

Views

Activity

NSButton Failing to Reflect a Change of its Image
[object Object]In a project I am developing with Xcode a 2d layout of the faces of Rubik's cube is displayed (see the attached Screenshot). In the center of each face's representation is a NSColorWell. The other eight cubes on that face are represented as NSButtons displaying an NSImage of the appropriate color. In response to the user selecting a new color the program resets the eight Button's image to one of the new color. The problem is that this change is not reflected on the display even if the NSButton is sent a setNeedsDisplay message. Sending the NSButton a display message also has no effect. The change is not seen until the Button receives a mouse click or interestingly if the window is dragged from the main screen to a second screen. I believe this a bug in AppKit.
4
1
1.5k
Nov ’22
Metal Demo: Hit Test , Mouse Pick , Shadows
I am a hobbyist programmer and I have been fooling around with Metal. In getting my feet wet in metal I have found that there is a pretty big gap between the HelloTriangle and DeferredLighting sample code from Apple and a more intermediate sample would be helpful. I have stumbled along through the brush and put together a little app that I thought that other novice metal programmers might find interesting. Features: Vertex buffer creation in Object Space. Composing objects into a scene in Model Space. Transforming a scene in Model Space to Clip Space Hit Testing / Mouse Picking Two pass rendering to produce shadows. I have put the project on GitHub for others to peruse: github.com/MackenzieBD/Sample-Code/blob/main/MetalDemo.zip
2
0
1.3k
Feb ’22
CFBundleIdentifier Collision
I am trying to submit a new App to the Mac AppStore. In App Store Connect, I create a new and enter the app's bundle identifier in the proper field. Then when I use Xcode to submit the application I get the following error codes:ERROR ITMS-90511: "CFBundleIdentifier Collision. The Info.plist CFBundleIdentifier value '$(PRODUCT_BUNDLE_IDENTIFIER)' of 'Mad Octahedron.app/Contents/Resources/MadOctahedron' is already in use by another application."An unknown error occurred.ERROR ITMS-90277: "Invalid Bundle Identifier. The application bundle contains a tool or framework $(PRODUCT_NAME) [com.Ambraw.MadOctahedron.pkg/Payload/Mad Octahedron.app/Contents/Resources/MadOctahedron] using the bundle identifier '$(PRODUCT_BUNDLE_IDENTIFIER)', which is not a valid bundle identifier."An unknown error occurred.ERROR ITMS-90261: "Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle $(PRODUCT_NAME) [com.Ambraw.MadOctahedron.pkg/Payload/Mad Octahedron.app/Contents/Resources/MadOctahedron] property list file."An unknown error occurred.I've tried changing the identifier and resubmitting but get the same errors. Would anyone have any ideas?
4
0
15k
Feb ’22
Help Books not working
After upgrading to Monterey I found that the Help system wasn't displaying my Help Books. After wasting an hour or so I figured out the the Help system will not display a Help Book unless the app was launched from the Applications folder. So, if you're launching the app from Xcode the Help Book won't work. If you want to see if the Help Book is properly configured you have to dig into the project's DerivedData folder, drag the app to the Applications folder and launch it from there.
1
0
842
Jan ’22
GCD dispatch_apply()
In the code snippet below, I am trying to have a routine run concurrently with GCD. However, the queue runs the code serially. How would one force the queue to run concurrently? The WWDC 2017 VIDEO shows: dispatch_apply( DISPATCH_APPLY_AUTO , count , ^(size_t i) { ...} ); but Xcode doesn't seem to recognize this syntax. Would there be a value for the flag parameter of dispatch_get_global_queue that would force concurrency. code-block dispatch_queue_t aQueue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0); dispatch_apply( turnsMax , aQueue , ^( size_t t ) {
3
0
1.5k
Dec ’21
NSKeyedArchiver
I am having trouble with NSKeyedArchiver. I create an archive with archive = [NSDictionary dictionaryWithObjectsAndKeys: pruneTableP2, @"depth table", nil]; archiveData = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding: NO error: nil]; I then get a "The data isn’t in the correct format" error when I go to unarchive it with unarchivedObjectOfClass:. The subsequent call to a depreciated method works however. archive = [NSKeyedUnarchiver unarchivedObjectOfClass: [NSDictionary class] fromData: fileData error: &error]; if( archive == nil ) { archive = [NSKeyedUnarchiver unarchiveObjectWithData: fileData]; NSLog( @"%@", [error localizedFailureReason]); } What am I doing wrong?
7
0
2.0k
Nov ’21
Random Numbers
What is the approved method of getting a random number in macOS in Objective C? Presently I'm using: srandomdev(); randomDevice = fopen("/dev/random", "r"); // // // -(uint64)random64 { uint64_t value = 0; int i; for (i = 0 ; i < sizeof(value); i++) { value <<= 8; value |= fgetc(randomDevice); } return value; } However, this method no longer appears in the documentation. Is there a more modern implementation?
3
0
1.6k
Nov ’21
Xcode won't compile UTType class methods
I'm having trouble using any of the UTType class methods When I try to use any of the class methods such as: ` UTType *foo; foo = [UTType typeWithIdentifier: @"foo" ]; Xcode displays the error: No known class method for selector 'UTTypeImage' Is there a header file I need to #import?
Replies
2
Boosts
0
Views
1.5k
Activity
Dec ’22
NSButton Failing to Reflect a Change of its Image
[object Object]In a project I am developing with Xcode a 2d layout of the faces of Rubik's cube is displayed (see the attached Screenshot). In the center of each face's representation is a NSColorWell. The other eight cubes on that face are represented as NSButtons displaying an NSImage of the appropriate color. In response to the user selecting a new color the program resets the eight Button's image to one of the new color. The problem is that this change is not reflected on the display even if the NSButton is sent a setNeedsDisplay message. Sending the NSButton a display message also has no effect. The change is not seen until the Button receives a mouse click or interestingly if the window is dragged from the main screen to a second screen. I believe this a bug in AppKit.
Replies
4
Boosts
1
Views
1.5k
Activity
Nov ’22
Numeric Keyboard
I use an old USB keyboard. After the last system update (Monterey 12.4) the number keys no longer work. Are these keys no longer supported?
Replies
2
Boosts
0
Views
792
Activity
Jun ’22
Metal Demo: Hit Test , Mouse Pick , Shadows
I am a hobbyist programmer and I have been fooling around with Metal. In getting my feet wet in metal I have found that there is a pretty big gap between the HelloTriangle and DeferredLighting sample code from Apple and a more intermediate sample would be helpful. I have stumbled along through the brush and put together a little app that I thought that other novice metal programmers might find interesting. Features: Vertex buffer creation in Object Space. Composing objects into a scene in Model Space. Transforming a scene in Model Space to Clip Space Hit Testing / Mouse Picking Two pass rendering to produce shadows. I have put the project on GitHub for others to peruse: github.com/MackenzieBD/Sample-Code/blob/main/MetalDemo.zip
Replies
2
Boosts
0
Views
1.3k
Activity
Feb ’22
CFBundleIdentifier Collision
I am trying to submit a new App to the Mac AppStore. In App Store Connect, I create a new and enter the app's bundle identifier in the proper field. Then when I use Xcode to submit the application I get the following error codes:ERROR ITMS-90511: "CFBundleIdentifier Collision. The Info.plist CFBundleIdentifier value '$(PRODUCT_BUNDLE_IDENTIFIER)' of 'Mad Octahedron.app/Contents/Resources/MadOctahedron' is already in use by another application."An unknown error occurred.ERROR ITMS-90277: "Invalid Bundle Identifier. The application bundle contains a tool or framework $(PRODUCT_NAME) [com.Ambraw.MadOctahedron.pkg/Payload/Mad Octahedron.app/Contents/Resources/MadOctahedron] using the bundle identifier '$(PRODUCT_BUNDLE_IDENTIFIER)', which is not a valid bundle identifier."An unknown error occurred.ERROR ITMS-90261: "Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle $(PRODUCT_NAME) [com.Ambraw.MadOctahedron.pkg/Payload/Mad Octahedron.app/Contents/Resources/MadOctahedron] property list file."An unknown error occurred.I've tried changing the identifier and resubmitting but get the same errors. Would anyone have any ideas?
Replies
4
Boosts
0
Views
15k
Activity
Feb ’22
Help Books not working
After upgrading to Monterey I found that the Help system wasn't displaying my Help Books. After wasting an hour or so I figured out the the Help system will not display a Help Book unless the app was launched from the Applications folder. So, if you're launching the app from Xcode the Help Book won't work. If you want to see if the Help Book is properly configured you have to dig into the project's DerivedData folder, drag the app to the Applications folder and launch it from there.
Replies
1
Boosts
0
Views
842
Activity
Jan ’22
Left Hand Coordinates???
Is there any reason besides pure perversity that metal uses a left hand coordinate system?
Replies
2
Boosts
0
Views
2.0k
Activity
Dec ’21
GCD dispatch_apply()
In the code snippet below, I am trying to have a routine run concurrently with GCD. However, the queue runs the code serially. How would one force the queue to run concurrently? The WWDC 2017 VIDEO shows: dispatch_apply( DISPATCH_APPLY_AUTO , count , ^(size_t i) { ...} ); but Xcode doesn't seem to recognize this syntax. Would there be a value for the flag parameter of dispatch_get_global_queue that would force concurrency. code-block dispatch_queue_t aQueue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0); dispatch_apply( turnsMax , aQueue , ^( size_t t ) {
Replies
3
Boosts
0
Views
1.5k
Activity
Dec ’21
NSKeyedArchiver
I am having trouble with NSKeyedArchiver. I create an archive with archive = [NSDictionary dictionaryWithObjectsAndKeys: pruneTableP2, @"depth table", nil]; archiveData = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding: NO error: nil]; I then get a "The data isn’t in the correct format" error when I go to unarchive it with unarchivedObjectOfClass:. The subsequent call to a depreciated method works however. archive = [NSKeyedUnarchiver unarchivedObjectOfClass: [NSDictionary class] fromData: fileData error: &error]; if( archive == nil ) { archive = [NSKeyedUnarchiver unarchiveObjectWithData: fileData]; NSLog( @"%@", [error localizedFailureReason]); } What am I doing wrong?
Replies
7
Boosts
0
Views
2.0k
Activity
Nov ’21
Random Numbers
What is the approved method of getting a random number in macOS in Objective C? Presently I'm using: srandomdev(); randomDevice = fopen("/dev/random", "r"); // // // -(uint64)random64 { uint64_t value = 0; int i; for (i = 0 ; i < sizeof(value); i++) { value <<= 8; value |= fgetc(randomDevice); } return value; } However, this method no longer appears in the documentation. Is there a more modern implementation?
Replies
3
Boosts
0
Views
1.6k
Activity
Nov ’21
Interface Builder: setting a window Restorable has no effect
I have set the property Restorable for a window in Interface Builder but it has no effect. The window's size and location are not restored from one launch to the next. What needs to be done to get this to work right?
Replies
0
Boosts
0
Views
683
Activity
Jun ’21