Re: Cocoa-dev Digest, Vol 19, Issue 24

2022-04-04 Thread Richard Charles via Cocoa-dev


> On Apr 4, 2022, at 8:58 AM, Michal L. Wright via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> I have a rather large Objective C project that I'm building in Xcode 13.3, 
> running under macOS 12.3. 
> (98 .m files with matching .h files, and a dozen or so .h files containing 
> defines, with the release version of the app itself being 13.8 MB.)

My app is also large Objective C project with 247 primary source files with the 
release version at 24.6 MB. Also using Xcode 13.3 running under macOS 12.3.


> When I run the app in Xcode (whether in debug mode or not), the All Output 
> window produces the following:
> 
> 2022-04-02 10:11:07.626094-0700 iData Pro 5.0.00[73856:2163752] 
> [logging-persist] cannot open file at line 45530 of [9ff244ce07]

I was getting output like this several weeks ago but now it has stopped. Not 
sure why. My app uses CoreData but not a sandbox.

https://stackoverflow.com/questions/56461441/sqlite3-open-cannot-open-file-at-line


> 2022-04-02 10:11:07.626135-0700 iData Pro 5.0.00[73856:2163752] 
> [logging-persist] os_unix.c:45530: (0) open(/var/db/DetachedSignatures) - 
> Undefined error: 0

I was getting output like this several weeks ago. The file did not exist on my 
system. So I created one and never saw the message again.

touch /var/db/DetachedSignatures

https://developer.apple.com/forums/thread/131498


Richard

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Distributing Mac App to Registered Devices

2021-06-23 Thread Richard Charles via Cocoa-dev


> On Jun 23, 2021, at 12:49 PM, James Walker via Cocoa-dev 
>  wrote:
> 
> Notarize your beta builds, just like you should be doing with your release 
> builds.

Yes, that is what I do now. However when upgrading to Xcode 12 it wants to 
change the debug and release configuration to use development signing. 
Notarized builds are reserved for archiving. Just saying that Apple is steering 
everyone in that direction.

Apple's answer to the problem is registering devices in your developer account. 
Except is does not work with mac devices.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Distributing Mac App to Registered Devices

2021-06-23 Thread Richard Charles via Cocoa-dev
How do you distribute software (not on app store) to Mac beta testers and not 
be presented with a malicious software warning?

When upgrading a project to Xcode 12.5 it wants to change the debug and release 
configuration to use development signing.

However when a beta tester downloads and opens a debug or release configuration 
version of the app with development signing they are presented with a malicious 
software warning.

One way to open the app anyway is to go to System Preferences > Security & 
Privacy and click Open Anyway.

Another way is for the developer to register the device UDID of the beta 
tester’s machine. However it does not work. The registered machine is still 
presented with a malicious software warning when opening the app. So has anyone 
gotten this to work?

https://developer.apple.com/documentation/xcode/distributing-your-app-to-registered-devices

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Several different NSUserDefaults in the same app?

2021-04-04 Thread Richard Charles via Cocoa-dev

> On Apr 4, 2021, at 12:15 AM, Jack Brindle via Cocoa-dev 
>  wrote:
> 
> This does work in Big Sur, we use it ourselves. The down side is that you 
> don’t have the nice (and infuriating) caching of defaults that the system 
> provides.


Why does Apple cache the defaults, what are the positive benefits? I have only 
ever been infuriated with this process during development.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Several different NSUserDefaults in the same app?

2021-04-04 Thread Richard Charles via Cocoa-dev

> On Apr 4, 2021, at 4:50 AM, Mike Abdullah  wrote:
> 
>> From the docs - init returns an initialized NSUserDefaults object whose 
>> argument and registration domains are already set up. This method does not 
>> put anything in the search list. Invoke it only if you’ve allocated your own 
>> NSUserDefaults instance instead of using the shared one.
>> 
>> So it appears that using alloc int does not return the shared instance.
> 
> Where in the docs do you read that? The current NSUserDefaults docs say 
> contrary:


Sorry for the confusion. It is older 10.9 documentation for the init method. 
Apple depreciated initWithUser: and added initWithSuiteName: around this same 
timeframe.


> On Apr 4, 2021, at 12:15 AM, Jack Brindle via Cocoa-dev 
>  wrote:
> 
> Gabriel;
> 
> It appears you are trying to get NSUserDefaults to do something that Apple 
> doesn’t want it to do these days. Why not create your own defaults,
> writing the data to a dictionary that is then written to a file that you save 
> in the ~/Library/Preferences folder, with a name of your choice?
> 
> This does work in Big Sur, we use it ourselves. The down side is that you 
> don’t have the nice (and infuriating) caching of defaults that the system 
> provides.
> Note that the system will still create the standard user defaults file for 
> you, to save things like window positioning. But, you can save these things
> yourself in your own files. Just make sure you don’t use the same file name 
> as the system uses, or it will overwrite yours. You can modify it as you 
> suggested previously, though.


So Jack I am curious, do you use alloc then init or initWithSuiteName:nil or 
initWithSuiteName:@“mySuiteName" to create your own defaults?

--Richard Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Several different NSUserDefaults in the same app?

2021-04-03 Thread Richard Charles via Cocoa-dev


> On Apr 3, 2021, at 9:56 AM, Gabriel Zachmann  wrote:
> 
> Sorry for asking: the shared instance is the one that is persistent, right?


Looks like an instance created from alloc init would not be useful in your 
situation. It appears you would be in charge of persistence.

NSUserDefault , Alloc init vs standard Userdefault

https://stackoverflow.com/questions/36615260

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Several different NSUserDefaults in the same app?

2021-04-03 Thread Richard Charles via Cocoa-dev

> On Apr 3, 2021, at 8:59 AM, Gabriel Zachmann  wrote:
> 
> Thanks a lot for your response!
> 
>> How about something like this?
>> 
>>NSUserDefaults *monitor1 = [[NSUserDefaults alloc] init];
>>[monitor1 setBool:YES forKey:@"MyKey”];
>> 
>>BOOL value = [monitor1 boolForKey:@"MyKey"];
> 
> So, where is the kind of monitor encoded?
> I mean, how does the code distinguish between the preferences of monitor1 and 
> monitor2?
> 
> Can you explain to me, what is the difference between 
>   [[NSUserDefaults alloc] init]
> and
>   [NSUserDefaults standardDefaults]
> ?
> I didn't get that from Apple's docs.
> 


From the docs - init returns an initialized NSUserDefaults object whose 
argument and registration domains are already set up. This method does not put 
anything in the search list. Invoke it only if you’ve allocated your own 
NSUserDefaults instance instead of using the shared one.

So it appears that using alloc int does not return the shared instance.

It would be up to you to determine the monitors attached to the computer using 
NSScreen and or CGDirectDisplay routines.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Several different NSUserDefaults in the same app?

2021-04-03 Thread Richard Charles via Cocoa-dev

> On Apr 3, 2021, at 5:40 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> But what I would like to have is a mechanism that lets me manage different 
> user defaults when the app is running on different monitors.
> Something like
> 
>  [ [NSUserDefaults userDefaultsWithName:@"monitor-name"] boolForKey:@"some 
> key"]


How about something like this?

 NSUserDefaults *monitor1 = [[NSUserDefaults alloc] init];
 [monitor1 setBool:YES forKey:@"MyKey”];

     BOOL value = [monitor1 boolForKey:@"MyKey"];


--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
So why not just do this.

[myView translatesAutoresizingMaskIntoConstraints:NO];
[myView setAutoresizingMask:myMask];

--Richard Charles


> On Oct 17, 2020, at 2:47 PM, Andreas Falkenhahn  
> wrote:
> 
> No, they are inserted programmatically.
> 
>> On 17.10.2020 at 18:41 Richard Charles wrote:
>> 
>> Just curious if these three subviews are in a nib or xib file or
>> are they inserted into the content view programmatically?
>> 
>> --Richard Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
Just curious if these three subviews are in a nib or xib file or are they 
inserted into the content view programmatically?

--Richard Charles


> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn  
> wrote:
> 
> Thanks, out of curiosity I've tried to override the "layout" method and see 
> if it works and it indeed does. So it looks like simply overriding the 
> "layout" method and doing the positioning and sizing there is also possible 
> without using any Auto Layout features whatsoever...
> 
> On 17.10.2020 at 16:30 Richard Charles wrote:
> 
>> You could call this method on your three views.
>> 
>> -[NSViewView setAutoresizingMask:]
>> 
>> --Richard Charles
>> 
>> 
>>> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>>>  wrote:
>>> 
>>> Hi,
>>> 
>>> I have an NSView that I set as the content view of my NSWindow. The NSView 
>>> has three subviews. Where should I reposition and resize those three 
>>> subviews when the NSWindow size changes? 
>>> 
>>> I see that NSView has a "layout" method that can be overridden but AFAIU 
>>> this is only to be used for Auto Layout. I don't want to use Auto Layout 
>>> because my whole layout is very simplistic and just involves those three 
>>> subviews which I can easily position and size manually. I just need to know 
>>> where to put the code that sets their new position and size... anyone?
>>> 
>>> -- 
>>> Best regards,
>>> Andreas Falkenhahn

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
You could call this method on your three views.

-[NSViewView setAutoresizingMask:]

--Richard Charles


> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> I have an NSView that I set as the content view of my NSWindow. The NSView 
> has three subviews. Where should I reposition and resize those three subviews 
> when the NSWindow size changes? 
> 
> I see that NSView has a "layout" method that can be overridden but AFAIU this 
> is only to be used for Auto Layout. I don't want to use Auto Layout because 
> my whole layout is very simplistic and just involves those three subviews 
> which I can easily position and size manually. I just need to know where to 
> put the code that sets their new position and size... anyone?
> 
> -- 
> Best regards,
> Andreas Falkenhahn

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and Drop of NSTokenField stopped working in Catalina

2020-06-30 Thread Richard Charles via Cocoa-dev

> On Jun 30, 2020, at 4:32 AM, Michael Kloske via Cocoa-dev wrote:
> 
> Hello,
> 
> in my application I have several NSTokenField - objects that are used to drag 
> them into a text field to build up a string by some tokens.
> However, since Catalina dragging of those NSTokenField - objects does not 
> work anymore.
> In Xcode I get the following message:
> 
> ": There was an exception (There are 2 
> items on the pasteboard, but 1 drag images. There must be 1 draggingItem per 
> pasteboardItem.) raised while processing drag. Ignoring…”


The NSTokenField is used in the Mail application in the address field. Using 
the Mail app in Catalina, drag a token from the address field to a TextEdit 
document. Does that work?

I would try it but my primary development machine is macOS Sierra.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Launching in fullscreen gives "Funk" sound sometimes

2020-06-24 Thread Richard Charles via Cocoa-dev

> On Jun 24, 2020, at 10:57 AM, Gabriel Zachmann via Cocoa-dev wrote:
> 
>> 
>> Set a symbolic breakpoint on NSBeep and see whether it’s your code that’s 
>> calling it.
>> 
> 
> Thanks, but how would I do that?
> I never use NSBeep in my code ..
> 
> Best regards, Gabriel


Symbolic Breakpoints

https://www.bignerdranch.com/blog/xcode-breakpoint-wizardry-for-debugging/


--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-25 Thread Richard Charles via Cocoa-dev


> On May 25, 2020, at 6:39 AM, Gabriel Zachmann via Cocoa-dev wrote:
> 
> Here is a screensaver (actually, screensaver builder) that can capture mouse 
> events:
> 
>   https://iscreensaver.com
> 
> Does anyone have an idea how they might be able to do it?
> 
> Best regards, Gabriel

Looks like a macOS application with screen saver functionality. You could 
download it and try it out and see how they do things. What does the installer 
do. Does simply install an app or are there other pieces installed. Open up the 
app package and see what is inside. That might give you a hint.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode Archive builds Debug version?

2020-05-24 Thread Richard Charles via Cocoa-dev


> On May 24, 2020, at 2:47 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I am confused: does Xcode really build the debug version when I make an 
> Archive?

There are two build configurations Debug and Release. The default build 
configuration is Debug when building and running.

Xcode uses the Release configuration when building an Archive. This is the same 
configuration used when Profiling.

You can see all of this in Edit Scheme...

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode Build Location

2020-05-15 Thread Richard Charles via Cocoa-dev
Thanks to everyone for your comments and suggestions.

I now have my app with embedded frameworks working as multiple individual 
projects or combined into a single workspace. It all works in Xcode 9 or 11 and 
archiving also works. The app was successfully notarized by Apple.

There is actually an informative technical note on the subject.

https://developer.apple.com/library/archive/technotes/tn2435/_index.html

I appreciate the list responding to an Xcode question. The xcode-users list has 
been shut down and I have yet to acquire a taste for the new apple-dev groups.

Thanks again.

--Richard Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode Build Location

2020-05-08 Thread Richard Charles via Cocoa-dev
> On May 7, 2020, at 10:04 PM, Rob Petrovec  wrote:
> 
> Have you considered using a workspace to handle building all of your 
> individual projects?  That should solve your file path & linking problem.
> 


Some of the dynamically linked libraries are large. If they are put in a 
workspace with the main project then it is so large it becomes cumbersome to 
work with.

One library has over 1,100 source files. Using a workspace for this collection 
of projects on a daily basis is not fun at all. It is actually counter 
productive.


> 
> btw, the 28 character string is a UUID.  I’m not sure about its lifetime.
> 


I don’t think these are a UUID. If a project is moved to another computer it 
has the same string appended to the project name in the build folder. If the 
build location is changed in Xcode preferences the appended string remains the 
same. The string does change if the name of the project enclosing folder is 
changed.

So maybe I have answered my own question. The string appears to remain constant 
as long as the project name and enclosing folder remain unchanged. So perhaps 
there is nothing to be afraid of here with regards to this string being part of 
a link path during build.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Xcode Build Location

2020-05-07 Thread Richard Charles via Cocoa-dev
I have a project that has several large dynamically linked libraries which are 
located in the application bundle. Each linked library is a separate project.

The setting in Xcode > Preferences > Locations > Advanced > Build Location is 
set to use Shared Folder > Build. Historically has worked well but now with 
Xcode 11 there are some drawbacks. For example Clean Build Folder cleans the 
entire shared build folder not just the target. Also archiving has never worked 
and still does not work with this configuration.

So now I have changed the Xcode setting from Shared Folder to Unique which 
apparently is the default.

When using the Unique setting a 28 character string is appended to the project 
name in DerivedData. The string appears to be random characters but most likely 
is not.

During build when linking to the dynamic libraries this 28 character string is 
in the file path. So if it ever changes then linking will fail.

So my question is will this 28 character unique string always remain constant 
for a given project?

Any insight would be appreciated.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Inconsistent fullscreen modes

2020-05-01 Thread Richard Charles via Cocoa-dev


> On May 1, 2020, at 12:34 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Is there a way to switch programmatically to fullscreen (and back) by the app,
> and still get the same behavior as if the user clicked the green window 
> button?


Something like this should work.

NSButton *button = [self.window standardWindowButton:NSWindowZoomButton];
NSCell *cell = button.cell;
[cell.target performSelector:cell.action];

Where self is the NSView object.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem in the creation of Graphics context(NSGraphicsContext)

2020-03-09 Thread Richard Charles via Cocoa-dev
I do not know Java at all but my guess is that when createImageRep is called 
the second time the new graphics context does not replace the static one saved 
during the first execution.

--Richard Charles


> On Mar 9, 2020, at 3:59 AM, Sravan Kumar Lakkimsetti 
>  wrote:
> 
> If some one wants to review the code for creating ImageRep its here 
> https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java#n38

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem in the creation of Graphics context(NSGraphicsContext)

2020-03-04 Thread Richard Charles via Cocoa-dev
I have a very similar setup. I tried the following.

NSBundle *bundle = [NSBundle mainBundle];
NSData *data = [NSData dataWithContentsOfFile:[bundle 
pathForResource:@"AAScreenShot" ofType:@"jpg"]];
NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:data];
NSGraphicsContext *context = [NSGraphicsContext 
graphicsContextWithBitmapImageRep:imageRep];
printf("Graphics Context %p\n", context);

Execute the above code and I get a graphics context when the window is in the 
high resolution display. Move the window to the secondary normal resolution 
display, execute the code, and I get another graphics context. You must be 
doing something wrong.

Normally a graphics context is valid for a given display. When the window moves 
from one display to another your app needs to detect this a pull another 
context.

https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html

"A renderer change can occur when the user drags a window from one display to 
another or when a display is attached or removed.”

This might not be true with an offscreen context which might remain valid 
regardless of the display.

--Richard Charles


> On Mar 3, 2020, at 11:19 PM, Sravan Kumar Lakkimsetti via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> In our product we use
> https://developer.apple.com/documentation/appkit/nsgraphicscontext/1529827-graphicscontextwithbitmapimagere?language=objc
> to create Graphics Context for drawing on top of image.
> 
> This particular API returns null in some cases. One particular case is
> troubling us. Would like to know why this happens and how to resolve.
> 
> Here is the problem.
> There are two monitors attached to Mac. Main display is retina display and
> secondary display is non-retina display. The application is moved from main
> display(retina display) to secondary display(non-retina display). In this
> case our application redraws the GUI(to use higher resolution images) In
> this process we are creating graphics context using the above api. This api
> returns null if the main display is retina and secondary display is
> non-retina.
> 
> It would be helpful if anyone can suggest on how to identify why this api
> returns null
> 
> Thanks
> Sravan
> 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion about screen resolution

2020-02-22 Thread Richard Charles via Cocoa-dev

> On Feb 22, 2020, at 7:34 PM, Quincey Morris via Cocoa-dev 
>  wrote:
> 
> The way things are now, starting from the selected Displays pane point size, 
> whatever that happens to be, the backing store is 2x or 3x — an integral 
> scale *up* — and the result is scaled — typically *down* by a non-integral 
> amount — to the hardware physical pixel dimensions of the screen.


Thank you Quincey for the excellent summary.

NSWindow documentation for the backingScaleFactor indicates "The value of this 
property is 2.0 for high-resolution scaled display modes, and 1.0 for all other 
cases."

I am just curious, have you actually seen a 3X backing store or is this just a 
surmise?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion about screen resolution

2020-02-22 Thread Richard Charles via Cocoa-dev


> On Feb 22, 2020, at 8:02 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
>> 
>> No, the default on recent Macs is scaled to slightly under 2x.
>> 
> 
> It is about ~ 1.7 .
> 
> this means that every view has to be scaled by this odd factor, before 
> writing its contents into the frame buffer.
> I am curious as to why that doesn't cause any aliasing artefacts, or 
> anti-aliasing artefacts ...
> 
> Best, G.
> 

This is bizarre. When did this start, Catalina? It has been my experience that 
the default scale factor is 1.0 for normal displays and 2.0 for Retina displays.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa #2

2019-12-10 Thread Richard Charles via Cocoa-dev


> On Dec 10, 2019, at 10:55 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> Thoughts?
> 


What if Apple were to open source Foundation, Core Data, etc., most every thing 
but the UI so that developers could more easily generate cross platform apps.

Recently visited this Microsoft web site where the tag line is 
"cross-platform". It would be interesting to know if this stuff really works.

https://dotnet.microsoft.com/learn/dotnet/what-is-dotnet

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-21 Thread Richard Charles via Cocoa-dev


> On Nov 20, 2019, at 3:16 PM, Jean-Daniel  wrote:
> 
> If Obj-C is dead, why is Apple still adding new language extensions (and not 
> minor one) ?
> 
> https://github.com/llvm/llvm-project/commit/d4e1ba3fa9dfec2613bdcc7db0b58dea490c56b1
> 


This commit on GitHub was made on Nov 18, 2019 by

Pierre Habouzit
Senior Software Engineer at Apple

and

Duncan Exon Smith
Engineering Manager, Clang Frontend Team at Apple

So that is a great point. If Objective-C is dying why is Apple going to all the 
trouble of adding new language extensions for performance gains?


--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-19 Thread Richard Charles via Cocoa-dev
> On Nov 13, 2019, at 11:58 AM, Richard Charles  wrote:
> 
> Apple released iTunes for Windows in October 2003.
> 


Apple just posted a job opening for a Senior Software Engineer- Windows Media 
Apps. It would be interesting to know how they plan on porting the new macOS 
media apps to Windows and what tools and frameworks they will be using.

https://jobs.apple.com/en-gb/details/200013614/senior-software-engineer-windows-media-apps

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-19 Thread Richard Charles via Cocoa-dev


> On Nov 19, 2019, at 6:24 PM, Pier Bover via Cocoa-dev 
>  wrote:
> 
>> When/if Apple decides to deprecate Cocoa they will announce it many years 
>> ahead of time
>> 
> 
> Like they did with 32 bits and OpenGL deprecation?
> 


The 32 bit depreciation has had a lot of discussion on this thread.

Although depreciated OpenGL and related dynamic libraries are still present in 
system frameworks on macOS Catalina. I have an app that depends on OpenGL and 
GLU and it runs fine on Catalina.

OpenGL was release 27 years ago and is used extensively in many technical 
fields. Perhaps this is why Apple has not yet removed these libraries from the 
system and GPU vendors still support the OpenGL compatibility profile.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-19 Thread Richard Charles via Cocoa-dev


> On Nov 19, 2019, at 9:41 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> I have been poking around on developer.apple.com, trying to get the big
> picture on the future of Cocoa for Mac. Ditto for the future of big apps.
> 


Send an email to Aaron Hillegass. He might be able to give you an educated 
guess about the remaining life of the Cocoa frameworks in Objective-C and the 
future of big apps on the Mac. Let us know if you hear back from him and what 
he tells you.

https://academy.realm.io/posts/altconf-aaron-hillegass-eulogy-for-objective-c/

You could submit a developer technical support incident to Apple and ask them 
point blank how much longer they will be supporting the Cocoa frameworks in 
Objective-C. Let us know if you hear back from them assuming the answer is not 
under a non-disclosure agreement.


> 
> It's all SwiftUI and Swift.
> 


If I understand it correctly, there is a linkage between Swift and Objective-C. 
Apple devised a way to call the Cocoa frameworks written in Objective-C from 
the Swift language using the magic of the LLVM compiler. A great question would 
be is possible for Apple to pull the Objective-C rug out from underneath the 
Cocoa frameworks leaving only a Swift implementation?

Carbon was a completely different animal. Apple pulled, so to speak, the core 
out of Foundation and came up with Core Foundation to give life and 
interoperability for the Carbon layer. However NOTHING of lasting value was 
built on the Carbon layer. The whole Carbon thing can be swept away and what 
difference does it make.

When committing to 64 bit Apple said NO to Carbon but YES to Cocoa and YES to 
Core Foundation and YES to a lot of other stuff. The OS still has the XNU 
(Mach) Kernel and FreeBSD (written in C & C++), the Cocoa frameworks (base 
layer written in Objective-C), Swift and lots of other stuff. From my point of 
view I do not see Apple sweeping away Objective-C and the Cocoa frameworks any 
time soon. Essentially they said as much in their 64-Bit Transition Guide.

https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/64bitPorting/HighLevelAPIs/HighLevelAPIs.html

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-13 Thread Richard Charles via Cocoa-dev


> On Nov 13, 2019, at 8:47 AM, Glenn L. Austin via Cocoa-dev 
>  wrote:
> 
> Having worked on an Apple cross-platform application that used the same APIs 
> that iTunes use...
>   ...was a nightmare.
> 
> You'd think that it would be easy, but there are so many assumptions about 
> *how* the APIs work and work together to get your code running - and many of 
> those assumptions simply weren't true when running in a Windows environment. 
> We spent a significant amount of time re-writing various APIs used by the 
> application because the RedBox ones we had access to simply didn't work.
> 
> We won't go into the facts that every Windows font size is *exactly* 33% 
> bigger than they are on the Mac (Windows is 96 dpi, Mac is based on 72 dpi: 
> 96/72 = 4/3). Or that a mouse on Windows was less precise but targets were 
> smaller. Or the myriad of other "issues" that make a Windows app just "feel 
> different."
> 

I am no expert, but I am a little confused.

The Cocoa API provides a very broad surface area covering the hosting OS. In 
1994 the OpenStep API (predecessor to Cocoa) ran on NeXTSTEP, Windows NT and 
Solaris.

The Red Box, Blue Box, Yellow Box was 1997.

Apple released iTunes for Windows in October 2003.

Over the last 16 years would bet that a lot of spit and polish has gone into 
integrating Cocoa with Windows by the iTunes team.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-12 Thread Richard Charles via Cocoa-dev


> On Nov 12, 2019, at 2:14 PM, Jean-Daniel via Cocoa-dev 
>  wrote:
> 
> What would be the benefit for Apple to support public API for Windows ?
> 


More applications available for the Mac.

Reduce the number of app developers abandoning the Mac platform.

Reduce the number of inferior electron apps on the Mac platform.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-12 Thread Richard Charles via Cocoa-dev

> On Nov 12, 2019, at 1:16 PM, GNDGN  wrote:
> 
> ‘It’s like giving a glass of ice water to somebody in hell’ - Jobs
> 

Apple released iTunes for Windows in October 2003. Apparently Cocoa and any 
supporting frameworks were ported to Windows 16 years ago. So what is the 
problem providing this to outside developers?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-12 Thread Richard Charles via Cocoa-dev


> On Nov 11, 2019, at 6:05 PM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> Unfortunately, software for any vertical or specialty market has to deal with 
> Mac market share.
> 


I just downloaded iTunes 12.10.2.3 (64 bit) for Windows 10 Pro. It runs great, 
looks great, no crashes. An examination of application files shows dlls for 
CoreFoundation, CoreText, Foundation, CoreGraphics, Objective-C, etc. This is a 
Cocoa application.

Why can't Apple provide tools so that outside developers can also do this?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on productivity

2019-10-25 Thread Richard Charles via Cocoa-dev


> On Oct 24, 2019, at 1:29 PM, Jens Alfke  wrote:
> 
> Have you tried the app Dash*? It's a general-purpose documentation browser, 
> and it will automatically index and search installed Apple docsets, much 
> better than Xcode does. I can't live without it.

I did not know about Dash. Much better presentation of Apple documentation than 
what Apple offers. Thanks for sharing.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on productivity

2019-10-24 Thread Richard Charles via Cocoa-dev


> On Oct 24, 2019, at 7:04 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:

> Is there a way to fix this stuff?

> For the rest, Apple really needs to listen to developers more.

Some random thoughts.

Before September 2014 the developer documentation was excellent. Excellent 
online documentation with downloadable and searchable pdfs. Now all pdfs are 
gone and online documentation is like art on display in a museum. Great to look 
at but not very usable.

I think you missed a step when learning Cocoa. A great way to start is with 
something like Cocoa Programming for Mac OS X by Aaron Hillegass. It has lots 
of examples to reinforce what you are learning.

Hopefully the Feedback Assistant will bring better results than the Bug 
Reporter.

Apple Developer Forums are perhaps like the current documentation. Nice to look 
at but not very useful. Interesting that this list has had somewhat of a 
resurgence in recent months.

Apple sample code should compile and run on the current version of Xcode. 
Period. What good is sample code if it takes a day to get it up and running.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Not seeing rightMouseDown: - what are the docs actually saying ?

2019-10-21 Thread Richard Charles via Cocoa-dev
> On Oct 20, 2019, at 8:27 AM, Aandi Inston  wrote:
> 
> We have a workaround, which is to move our right click processing onto 
> MouseUp, which is passed up the responder chain as we wish in both 32 and 64 
> bit systems. But I remain curious as to what the docs are actually telling me.

From NSResponder documentation.

"Prior to OS X v10.7, NSView did not pass unhandled rightMouseDown(with:) 
events up the responder chain. In macOS 10.7 and later, NSView passes 
rightMouseDown(with:) events up the responder chain if AppKit doesn’t find an 
associated context menu to display for the view. To avoid binary compatibility 
issues, this new behavior is enabled only for applications linked on macOS 10.7 
or later."

Sounds straight forward to me. Perhaps you need to read it again.

I created a new app with Xcode 9.2 and linked to 10.13. Created a custom view 
and custom window with rightMouseDown logging. Built the app for 32 bit and 64 
bit. An unhandled rightMouseDown is passed promptly from view to window in both 
cases.

Also the NSView documentation states.

"Because NSView changes the default behavior of the rightMouseDown: method, you 
should call super when implementing that method in your custom subclasses."

Are you doing this?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Not seeing rightMouseDown: - what are the docs actually saying ?

2019-10-20 Thread Richard Charles via Cocoa-dev
Your email client line breaking makes for very difficult reading so I 
reformatted. See below.

Why are you compiling a plugin for 32 bits?

Just tested a 64 bit app linked to 10.8 and an unhandled rightMouseDown is 
passed promptly from view to window. Testing in 32 bits would be a lot of work. 
Too many changes to down grade from 64 to 32 bit.

--Richard Charles

> On Oct 18, 2019, at 3:10 PM, Aandi Inston via Cocoa-dev 
>  wrote:
> 
> I believe I may be seeing an effect described in the Cocoa docs for the 
> rightMouseDown: method. I am unsure exactly what the docs are saying however. 
> Symptom: compiled for 64-bits, an unhandled rightMouseDown: is eventually 
> sent to the NSWindow subclass, but compiled for 32-bits (and run on 10.11.6 
> at least) the event never arrives.
> 
> For NSView, we see "In macOS 10.7 and later, if the event is not handled, 
> this method passes it up the responder chain." For NSResponder we see "Prior 
> to OS X v10.7, NSView did not pass unhandled rightMouseDown: events up the 
> responder chain. In macOS 10.7 and later, NSView passes rightMouseDown: 
> events up the responder chain if AppKit doesn’t find an associated context 
> menu to display for the view. To avoid binarycompatibility issues, this new 
> behavior is enabled only for applications linked on macOS 10.7 or later."
> 
> But what is the actual test for whether to do this? "Running on" and "linked 
> on" are both 10.11. Is it actually looking at the "Deployment target"? To 
> make matters worse, my code is running as a plug-in and I'm going to take a 
> guess that if a deployment target applies, it is the one selected in the main 
> executable (not under my control) rather than the plug-in... can anyone 
> explain what Cocoa would be looking at?
> 
> And if it turns out that I'm not going to get rightMouseDown: sent directly 
> to my NSWindow, is there any alternative to subclassing any NSView or 
> descendent (including NSControls of various flavours) that might be the 
> initial responder?
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need for Swift

2019-10-15 Thread Richard Charles via Cocoa-dev


> On Oct 15, 2019, at 11:27 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> The basic language problem as I see it is in the headers.  Classes are
> either Obj-C or C++ and can't be both.  It turned out to be an enormous
> barrier that caused all sorts of pains.

>From older documentation.

"The class hierarchies are separate; a C++ class cannot inherit from an 
Objective-C class, and an Objective-C class cannot inherit from a C++ class."

This may or may not help. I use the following inline macro for C++ prototypes 
in dual purpose headers.

#ifdef __cplusplus
#define CPP(x) x
#else
#define CPP(x)
#endif

That way you can import or include the same header into a .m or .mm source file.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need for Swift

2019-10-15 Thread Richard Charles via Cocoa-dev


> On Oct 15, 2019, at 7:57 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> TurtleSoft has a big investment in C++ source code that's full of 
> construction business logic. Unfortunately, with the death of Carbon its 
> future value is in doubt.


I have found your comments enlightening. So if I understand correctly you have 
three choices for a native UI on the Mac.

1. Objective-C which would integrate nicely with your C++ business logic using 
Objective-C++. One problem is you have very little experience with the Cocoa 
frameworks. Another problem is you are hesitant to pursue this path fearful 
that down the road Apple may abandon Objective-C.

2. Another option is Swift but it has zero integration with C++. So this is 
really not a choice at all.

3. A third option would be to combine all three. Keep your business logic in 
C++ and combine with Objective-C using Objective-C++ and then bridge to Swift. 
That does sound like a nightmare.

Looks like you are in a pickle.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need for Swift

2019-10-12 Thread Richard Charles via Cocoa-dev

> On Oct 11, 2019, at 9:09 PM, Kirk Kerekes via Cocoa-dev 
>  wrote:
> 
> It is my inference that Swift arose out of a perceived need for a language 
> that strongly inhibited bad/lazy/sloppy programming practices, and yet looked 
> “normal”.

Here is my take. I think Swift came from the mind of Chris Lattner who showed 
it to management and they loved the idea. It was made possible by the power and 
flexibility of the LLVM compiler.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-11 Thread Richard Charles via Cocoa-dev
> On Oct 11, 2019, at 7:07 PM, 조성빈  wrote:
> 
>> 2019. 10. 12. 오전 9:55, Richard Charles via Cocoa-dev 
>>  작성:
>> 
>> None but the biggest of companies can do this.
> 
> That’s not true, web apps aren’t really complex if you get to use the npm 
> ecosystem. There are high quality libraries that do much of the heavy 
> lifting, so writing ones usually are wiring glue code between the libraries.

Multiple versions of an app possibly consisting of a browser base web app along 
with a high performance and convienent native desktop app (possibly native on 
Mac and Windows) and a native mobile app (possibly native on iOS and Android), 
a file based format for offline storage (native on Mac and Windows) and a cloud 
based format for online storage and colloraboration all working seamlessly 
together. Unless I am mistaken Adobe and Microsoft approach this with Creative 
Cloud and Office 360 apps.

None but the biggest of companies can to this.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-11 Thread Richard Charles via Cocoa-dev


> On Oct 11, 2019, at 1:14 PM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
>>> I know this is the Cocoa devs list... but why not make a website?
>>> It would be easier to develop, completely crossplatform, no app store
>>> complications, you would be in total control of your stack, etc.
> 
> QuickBooks has gone that route.  They still grudgingly sell desktop apps,
> but really push people towards their cloud version.  Besides all the
> benefits you mention, it's a steady monthly income.  Hence why Microsoft
> and Adobe are also going that route.  Apple too.

If I understand this correctly.

Microsoft Office Web apps (Word, Excel, PowerPoint) are simplified versions of 
desktops apps that run in a web browser along with a subscription service.

Apple iWork web apps (Pages, Numbers, Keynote) are feature complete versions of 
desktop and mobile apps that run in a web browser. Apple has never released the 
details of how they do this.

Adobe Creative Cloud apps (Lightroom and Photoshop) are native apps for desktop 
and mobile with cloud based storage and a subscription service. They are not 
cross-platform browser based web apps.

None but the biggest of companies can do this.

One alternative for native desktop apps is a Box Integration.

https://support.apple.com/en-us/HT207876

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-11 Thread Richard Charles via Cocoa-dev

> On Oct 11, 2019, at 4:46 PM, Jens Alfke  wrote:
> 
>> On Oct 11, 2019, at 12:22 PM, Richard Charles  wrote:
>> 
>> A second choice "Cross-platform Cocoa App" would be great for the small 
>> developer who’s focus is on business applications. All whole world doesn’t 
>> revolve around games.
> 
> https://developer.apple.com/xcode/swiftui/
> https://developer.apple.com/mac-catalyst/

What I meant to say was Cross-platform as in Microsoft Windows.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-11 Thread Richard Charles via Cocoa-dev

> On Oct 11, 2019, at 11:21 AM, Jens Alfke via Cocoa-dev 
>  wrote:
> 
> What you can do is give them feedback about your specific experience, as 
> you're doing, and I hope that someone at Apple is reading this thread and 
> taking notice.

When creating a new project in Xcode one of the choices is Cross-platform. 
Under this tab the only choice available is "Cross-platform Game".

A second choice "Cross-platform Cocoa App" would be great for the small 
developer who’s focus is on business applications. All whole world doesn’t 
revolve around games.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa

2019-10-10 Thread Richard Charles via Cocoa-dev

> On Oct 10, 2019, at 5:20 PM, Charles Srstka via Cocoa-dev 
>  wrote:
> 
> Yes, they marketed Carbon as a first-class citizen, promoted as “the basis 
> for all life,” and even rewrote the Finder and Dock—which already had Cocoa 
> implementations from NeXT—in Carbon just to prove that they were serious 
> about it.

Just a guess but perhaps management had an awakening when they found the time 
and effort expended to write the next even better version of Finder in Carbon 
was substantially more difficult and costly that the prior Cocoa version.

> I still remember reading this thread, and feeling nervous about it:
> 
> https://lists.apple.com/archives/cocoa-dev//2002/Jan/msg01366.html

Yes this is a very interesting thread. Here is a post on the same thread 
written by Erik M. Buck.

https://lists.apple.com/archives/cocoa-dev//2002/Jan/msg01329.html

"Carbon will exist as long as Apple exists.”

Apparently this is the same Erik M. Buck who coauthored the excellent book 
Cocoa Design Patterns with Donald Yacktman which came out in 2009.

So apparently Mr. Buck saw the light and had a change of mind. Apparently a lot 
of individuals at Apple had a change of mind and saw the light as Cocoa 
demonstrated itself superior technology. I think that is what happened.

> The common assumption among the more level-headed at the time was that Cocoa 
> was going to be gradually rewritten to sit on top of Carbon, with Carbon 
> sticking around as the lower-level, closer-to-the-metal API.

My guess is maybe outside the company this may have been the common view but 
not to every one inside the company. Core Foundation made Carbon possible on 
the new OS. It was written by borrowing stuff from Cocoa not the other way 
around.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-09 Thread Richard Charles via Cocoa-dev


> On Oct 9, 2019, at 11:58 AM, Pier Bover  wrote:
> 
> For example Imagix is a company that does image transformation in the cloud 
> and uses macs because of the high performance of CoreImage 
> (https://photos.imgix.com/racking-mac-pros) It's still more cost effective 
> for them to use expensive macs vs linux servers because of the performance 
> increase. Pretty amazing if you think about it.

They should be thrilled that Apple announced an optimized version of the 2019 
Mac Pro for rack deployment.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-09 Thread Richard Charles via Cocoa-dev


> On Oct 9, 2019, at 11:19 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> Why is Cocoa source code hidden?

Because Apple does not want to expose Cocoa source source. It is proprietary 
software.

> Many of the frustrations we had with the 64-bit update attempt were caused
> by Cocoa's lack of visible source. It was a "black box" that often required
> trial-and-error to figure out. Yeah, the headers are visible, and Apple has
> info online. But sometimes that was not sufficient to understand the actual
> implementation details.
> 
> When debugging, the stack trace inside Cocoa was just a bunch of
> rarely-helpful Assembly. No way to set breakpoints inside Cocoa classes, or
> step through their C code. More mysteries and headaches.

I agree reading assembly is horrid. Did you know that you can set a symbolic 
breakpoint on code inside the Cocoa frameworks? You can also swizzle a 
framework method to gain insight into what Apple is doing. You can also examine 
Cocotron source code for insight into what maybe going on behind the scenes.

> I personally learned C++ while using the PowerPlant library from
> Metrowerks. Its source files were totally exposed. Seeing comments and code
> really helped. When designing or debugging, it was possible to step through
> their code and see exactly how it functioned.  Cocoa would be so much
> easier to use if its source was accessible like that.
> 
> In fact, why isn't Cocoa open source?  Apple open-sources Swift and the
> Darwin kernel. Surely the GUI can't be any riskier to expose to developers?

Perhaps Apple does not want to give away the Crown Jewels.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa

2019-10-04 Thread Richard Charles via Cocoa-dev

> On Oct 4, 2019, at 4:43 AM, Dragan Milić via Cocoa-dev 
>  wrote:
> 
> Apple also strongly and clearly advised all new development should be done in 
> Yellow Box/Cocoa. Sure it took Apple too quite some time to transition 
> everything away from Carbon, but it was clear from the beginning that Carbon 
> was there just as long as it was really needed, and not a minute longer. With 
> every early major releases (until 2007) of macOS, Apple put strong emphasis 
> in release notes which OS-bundled applications have gone from Carbon to Cocoa.

I don’t think it was this clear. I remember reading an Apple employment 
advertisement roughly around 2005 that went something like this. "Join the 
engineering team and help us make the next Finder rewrite the absolute best 
ever with Carbon and C++.” It was reported that Apple had the 64 bit Carbon 
port done when the decision was made not to release the product but rather 
focus the company's resources and efforts on Cocoa instead. It appears there 
was a lot of internal turmoil within the company and the resistance to Cocoa 
was strong but eventually Cocoa won out the day because it is a superior 
technology.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa

2019-10-02 Thread Richard Charles via Cocoa-dev


> On Oct 2, 2019, at 11:14 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> Sadly, we just decided to abandon the Cocoa update for our app.

Great historical overview from a small developers perspective. Perhaps you 
should send this email to Tim Cook. It might some attention. Just a thought.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on ARC

2019-10-01 Thread Richard Charles via Cocoa-dev

> On Sep 30, 2019, at 5:57 PM, Sam Ryan wrote:
> 
> I tried a completely new approach - Electron. I have found Electron to be 
> surprisingly quick to prototype, easy to bridge to c++, and is cross platform 
> (non mobile at least). I would not have recommended a non-native approach 
> until recently, but for what it is worth, I've come to realise this is one of 
> the better options available these days. YMMV.

Interesting.

> On Sep 30, 2019, at 7:00 PM, Jens Alfke wrote:
> 
> If you don't mind coding in JavaScript, don't care about Mac UI guidelines, 
> and aren't shy about shipping a 200MB+ app that has an entire freakin' web 
> browser embedded in it…
> 
> (Sorry for the grumpiness. I'm just sick of all the "Mac apps" that are just 
> Electron-based web pages, e.g. Slack.)

Also interesting.

I found John Gruber's comments on Electron and the Decline of Native Apps 
enlightening.

https://daringfireball.net/2018/12/electron_and_the_decline_of_native_apps

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on ARC

2019-09-27 Thread Richard Charles via Cocoa-dev

> On Sep 27, 2019, at 1:21 PM, Jens Alfke  wrote:
> 
> I was typing a lengthy answer, but it occurred to me it's basically the same 
> reason why Apple didn't release macOS for generic PCs ('hackintoshes') and in 
> fact actively made it difficult for anyone to port macOS. It's because it 
> would damage or tank their hardware business. To a lesser degree, if it's 
> just apps being ported and not the whole OS, but still significant I think.
> 
> Porting your software crown jewels to run on commodity PC hardware is 
> something only a failing company does, when it's throwing its own hardware 
> business overboard. Consider NeXT and Be. (And I believe Amiga was planning 
> something similar before they went under.)
> 
> Anyway, these days Windows is only for cash registers, accountants, and 
> basement-dwelling hardcore gamers. ;-)

There a lot of business users still on Windows. Adobe, AutoDesk, and other 
large organizations have dual track development for Mac and Windows but this is 
hard for a small developer.

The computer aided design software that Apple engineers use to design their 
stuff is Unigraphics NX which runs on Windows and on the Mac under X11 because 
NX has a Unix heritage. So I don't think you will ever see the day that the Mac 
drops support for X11. The point is there are still business segments, users 
and developers that benefit from cross platform high performance desktop apps.

In 1998 Apple was more than ready to give away the crown jewels with the 
Rhapsody Yellow Box but Adobe made them change their mind when they refused to 
port Photoshop. Subsequently Apple changed the focus with Mac OS X and removed 
the cross platform offer. I think one of the major reasons was the amount of 
time they spent writing Core Foundation and Carbon. Perhaps they didn’t want to 
stretch their resources thin by also supporting Windows apps.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on ARC

2019-09-27 Thread Richard Charles via Cocoa-dev

> On Sep 27, 2019, at 6:19 AM, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> We used an object database called NeoAccess for our 32-bit C++ app.  It had
> reference counting for objects retrieved from the database.  Setting the
> ref count manually was extremely easy to screw up. It was hard to debug
> off-by-ones on the ref count.  So we made those calls private, and replaced
> them all with a stack-based watcher class.  It adds a reference in the
> constructor, and removes it in the destructor.  Simpler, more reliable, and
> exception-safe.
> 
> It makes sense that Cocoa programmers much prefer ARC to MRC. Doing it
> manually is easy to break and hard to debug.  However, the fact that ARC is
> not exception-safe concerns me.  It suggests that Cocoa still manages ref
> counts manually, somewhere under the hood.  We've had two sets of mystery
> deallocs that both involved NSTabView. From hard past experience, I would
> bet there is a bug lurking somewhere inside there.

Traditional Cocoa manual memory management relies on naming conventions and 
just a few basic rules. When combined with the Xcode static analyzer it is 
almost pain free. However it is not as Swift as latest thing.

> In fact, assuming that Cocoa is written entirely in plain C, it may not
> even be possible to avoid manual ref counts.  No STL, no RAII, no native
> exceptions.  It makes sense to write kernels in C because speed is
> important. But GUI frameworks are way more complex, and C may just not be
> the right tool for them.

Objective-C is plain C with a runtime and a few syntactic additions. The big 
and beautiful thing about Cocoa are frameworks which are written in Objective-C 
and now Swift.

> I'm no fan of garbage collection, but those languages do make programming
> easier.  There's enough other stuff to worry about. It's why Java & Python
> are so popular.
> 
> C++ makes the programmer fully responsible for memory, but the modern STL
> really helps. It's improving rapidly.  Even when C++ breaks, it's easy to
> debug object lifetimes.  Just put a breakpoint in the destructor. If it's
> dying too soon you'll see exactly what killed it.  If a leak it will never
> get there.
> 
> Our company sells to construction companies. Our expertise is in
> accounting, estimating and other construction business tasks.  We need a
> platform that lets us create apps quickly.  Cocoa is not that.  We've spent
> 3 years so far on 64-bit porting via Cocoa. Best guess is another year or 2
> to get it perfect. Meanwhile, we should be adding features to keep up with
> the Windows competition.

It appears like your biggest challenge is porting a 32-bit C++ third party 
library and porting Carbon to Cocoa? Moving from 32 bit Cocoa to 64 bit Cocoa 
should not be a big deal.

What I wish Apple would do is release a cross platform Objective-C (and Swift) 
solution. They already transitioned from PowerPC to Intel and ARM. iTunes at 
one time was released for Windows. One programmer almost did this single 
handedly with the Cocotron. It was so well written and comprehensive that 
Microsoft picked it up and started using it for their WinObjC framework. The 
Mac vs Windows war is over and long gone so why doesn’t Apple help out the 
small developer and release a cross platform solution.

> I don't know if anyone from Apple is on this list, but I think Cocoa needs
> a huge overhaul.  It's 30 years old and showing its age.  The problem is
> not just memory management. The constraint system is extremely difficult-
> we've spent many days futzing with it, and there are still mystery
> problems. Pretty much everything else is more creaky and awkward than it
> could be.
> 
> Swift may be the solution, but it's built on a weak foundation. It makes
> cross-platform development almost impossible. The TIOBE index shows Swift
> declining (and Objective-C increasing). So, maybe it isn't.
> 
> It would really help if programmers could write Macintosh apps in C++,
> Python, etc.

Apple did a language overhaul with Swift. My primary app requires integration 
with C++ so I have stuck with Objective-C and Objective-C++ and the traditional 
Cocoa frameworks.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Views without any layout constraints may clip their content or overlap other views

2019-09-26 Thread Richard Charles via Cocoa-dev

> Excerpt from Xcode 11 release notes originally quoted by Quincey Morris.
> 
> NSView and UIView have a layout mode option in the Size inspector to 
> explicitly opt into “translates autoresizing mask into constraints”. The 
> default setting is “Automatic”, which is the existing behavior. “Automatic” 
> implies that “translate autoresizing mask into constraints” is off when a 
> view affect by constraints in the storyboard or .xib file, but on if 
> unconstrained. (37352354)

Is it just me? I found this very confusing.

> On Sep 26, 2019, at 8:44 AM, Laurent Daudelin via Cocoa-dev 
>  wrote:
> 
> I just checked this Quincy. What I observe is that the top view in my windows 
> have the setting set to “Translates autoresizing mask into constraints” but 
> all the other subviews are set on “Automatic”. Should I leave it that way? 
> This is an old project predating the auto-layout, by the way.

I also noticed the same thing. The content view of the window has a different 
behavior and default compared to the subviews.

Previously Auto Layout was enabled or disabled per nib. Now the layout mode is 
per view and constraints can not be fully disabled. So the existing behavior is 
not present in Xcode 11.

IB Auto Layout or constraints was introduced around the Xcode 4.2 timeframe. An 
IB document could enable or disable Auto Layout with a check box in the file 
inspector. Looking through the historical Xcode release notes you can see it 
took a long time to get it working properly. This may be why some developers 
opted out of Auto Layout.

I have a large project with with Auto Layout turned off in each nib. I opened 
the project in Xcode 11 and started working my way through the nib warnings and 
then realized I don’t know what I am doing so I stopped.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Views without any layout constraints may clip their content or overlap other views

2019-09-23 Thread Richard Charles via Cocoa-dev


> On Sep 23, 2019, at 8:06 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Recently, I am getting lots of warnings saying
> "Views without any layout constraints may clip their content or overlap other 
> views"
> when I build my screen saver.

Try this. In Xcode navigator select the xib file then select one of the objects 
in the file. It can be any object in the file such as the window, the first 
responder, the file's owner, etc.

In the right side panel file inspector a section will appear titled "Interface 
Builder Document". In this section deselect "Use Auto Layout".

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: boundingRectWithSize gives wrong size

2019-09-10 Thread Richard Charles via Cocoa-dev
> On Sep 10, 2019, at 10:54 AM, Gabriel Zachmann  wrote:
> 
>> I have had good results with CTLineGetTypographicBounds().
> 
> This seems to be suitable only for single lines of text.
> But , usually, I've got 2 lines of text.
> 
> I looked at Core Text a bit further, but I could not find how to determine 
> the width/height of a two-line string.

For multiple lines you need to use a framesetter.

CTFramesetterCreateWithAttributedString()

CTFramesetterSuggestFrameSizeWithConstraints()

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: boundingRectWithSize gives wrong size

2019-08-28 Thread Richard Charles via Cocoa-dev


> On Aug 28, 2019, at 1:33 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I am trying to determine the size of a piece of text using 
> boundingRectWithSize.
> 
> The problem is that this method does not return the correct width. (The 
> height seems to be about right.) Sometimes, the width is only a little bit 
> too wide, sometimes it is much too wide.

I have had good results with CTLineGetTypographicBounds().

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa window messages in app being ported from Carbon

2019-08-10 Thread Richard Charles via Cocoa-dev


> On Aug 10, 2019, at 12:24 AM, Kurt Bigler via Cocoa-dev 
>  wrote:
> 
> I've just started implementing the Cocoa windows.  The NSView subclasses 
> involved are receiving drawRect: messages but are not receiving mouseDown:.

It seems to me like your window is not setup properly or the view is not 
properly configured in the window.

NSApplication dispatches a mouseDown event to NSWindow and the window 
dispatches the event to the NSView. The responder chain is not involved unless 
using the default implementation which simply passes the message to the next 
responder. The method acceptsFirstResponder does not play a roll in mouseDown.

You could subclass NSWindow and override sendEvent: to see what is happening 
during a mouse down.

#0  0x00011355 in -[MyView mouseDown:]
#1  0x7fff8d7db24f in -[NSWindow(NSEventRouting) 
_handleMouseDownEvent:isDelayedEvent:] ()
#2  0x7fff8d7d7a6c in -[NSWindow(NSEventRouting) 
_reallySendEvent:isDelayedEvent:] ()
#3  0x7fff8d7d6f0a in -[NSWindow(NSEventRouting) sendEvent:] ()
#4  0x7fff8d65b681 in -[NSApplication(NSEvent) sendEvent:] ()
#5  0x7fff8ced6427 in -[NSApplication run] ()
#6  0x7fff8cea0e0e in NSApplicationMain ()

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa window messages in app being ported from Carbon

2019-08-10 Thread Richard Charles via Cocoa-dev


> On Aug 10, 2019, at 3:21 PM, Rob Petrovec via Cocoa-dev 
>  wrote:
> 
> So he needs to implement hitTest to get mouseDown events.

I just made a new Cocoa App project with a custom view. I did not implement 
hitTest:. The view receives mouseDown events just fine.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Best Xcode machine mid-2019?

2019-07-02 Thread Richard Charles via Cocoa-dev

> On Jun 28, 2019, at 9:39 PM, Dave Fernandes via Cocoa-dev 
>  wrote:
> 
> Not a comprehensive list, but a start...
> https://github.com/ashfurrow/xcode-hardware-performance

Very interesting. Thanks for sharing.

I was surprised to see Custom Hackintosh machines contributing to the Xcode 
build performance data.

> On Jul 1, 2019, at 12:07 PM, Steve Mykytyn via Cocoa-dev 
>  wrote:
> 
> Looking at Activity Monitor during the build, all four CPU cores are
> utilized symmetrically, the four hyper-threads somewhat less.

I have an older Mac Pro (Quad-Core Intel Xeon) and the same thing happens. 
During build the CPU scores are heavily used but the hyper-threads somewhat 
less.

I always thought the physical cores and hyper-threads were used the same 
amount, but that is not the case. Apparently the physical cores are more 
powerful than the virtual cores. I never knew that.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Notarization error: The signature algorithm used is too weak

2019-05-29 Thread Richard Charles via Cocoa-dev


> On May 28, 2019, at 8:18 PM, Leo via Cocoa-dev  
> wrote:
> 
> Can you please elaborate on this...

Perhaps this will help.

https://stackoverflow.com/questions/25152451/are-mac-app-store-code-sign-resource-envelopes-always-version-1

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Is the list alive?

2019-05-29 Thread Richard Charles via Cocoa-dev


> On May 29, 2019, at 7:02 AM, Steve Mills via Cocoa-dev 
>  wrote:
> 
> Supposedly, these lists are to be done away with at some point. Someone 
> started co...@apple-dev.groups.io, which many of us have moved to. Or use the 
> annoying and inferior dev forums.developer.apple.com.

It is a mystery why this list is still alive.

Internally at Apple I would bet that most developers get their questions 
answered by asking another developer. The current documentation is very 
artistic but not very functional or useful for serious development.

A lot of questions can be answered by looking in stackoverflow, perusing older 
documentation or searching the web.

You can always submit a technical support incident but you will most likely be 
asked to submit a focused sample project demonstrating the issue.

I need to take a look at co...@apple-dev.groups.io. It looks interesting.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Notarization error: The signature algorithm used is too weak

2019-05-28 Thread Richard Charles via Cocoa-dev


> On May 28, 2019, at 3:43 PM, Leo via Cocoa-dev  
> wrote:
> 
> -I recently contacted Apple again and they pointed me to some resource page 
> that was created back in 2016. It briefly mentions a similar error - but 
> still without any info on how to solve it:
> https://developer.apple.com/library/archive/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG301
>  
> 
> -A search on this error didn't produce anything useful.
> 
> -The tar.gz file in question is an eSellerate licensing framework. As many 
> people may know, it's been a popular licensing??platform for Mac software for 
> over a decade. While I switched to a different licensing platform some time 
> ago, I still have thousands of customers with eSellerate licenses (as I'm 
> sure is the situation with many other Mac developers).
> 
> As far as I understand, this whole situation has to do something with signing 
> files inside tar.gz archives - on which I couldn't find any info either

Looks to me like your eSellerate framework is signed with a version 1 
signature. You need to resign the framework with a version 2 signature.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: xCode troubles

2019-05-14 Thread Richard Charles


> On May 14, 2019, at 10:19 PM, John McCall  wrote:
> 
> It's unfixed because it's apparently very hard to reliably reproduce.  If you 
> have reliable steps for reproduction, we'd be very interested.

Perhaps Peter Hudson could send you his corrupted project before it was reset. 
That might be useful.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cannot include Carbon on Mojave

2019-05-14 Thread Richard Charles
> On May 14, 2019, at 12:02 PM, Vojtěch Meluzín  
> wrote:
> 
> Not really,

Yes really, CarbonSound was depreciated in OS X v10.5. Depreciated does not 
mean that the framework has been removed from current installations of the OS 
(although that is possible). It means that developers are discouraged from 
using the API and that at some point in the future it may be unsupported or 
removed.

"Apple did not create a 64-bit version of Carbon while updating their other 
frameworks in the 2007 time-frame, and eventually deprecated the entire API in 
OS X 10.8 Mountain Lion, which was released on July 24, 2012."

https://en.wikipedia.org/wiki/Carbon_(API)


> On May 14, 2019, at 9:29 AM, Vojtěch Meluzín  
> wrote:
> 
> Compiling carbon.h ends up with this:
> 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/
> Carbon.framework/Headers/Carbon.h:34:10: fatal error:
> 'CarbonSound/CarbonSound.h' file not found

My guess is that this is deliberate and Xcode is trying to warn you move to 
another API. But maybe not and you will find a workaround.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cannot include Carbon on Mojave

2019-05-14 Thread Richard Charles

> On May 14, 2019, at 9:29 AM, Vojtěch Meluzín  
> wrote:
> 
> Hey folks,
> 
> I have a brand new computer (as well as old one), newest XCode, Mojave
> (unfortunately!). Compiling carbon.h ends up with this:
> 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/
> Carbon.framework/Headers/Carbon.h:34:10: fatal error:
> 'CarbonSound/CarbonSound.h' file not found

CarbonSound was depreciated in OS X v10.5.

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html

It looks to me like Apple is making good on their promise.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: xCode troubles

2019-05-14 Thread Richard Charles

> On May 14, 2019, at 4:39 AM, Peter Hudson  wrote:
> 
> Hi All
> 
> xCode has just decided ( for the 20th time this week ) that I don’t deserve 
> any UI tools in Interface Builder - as in the panel on the right hand side of 
> the main window.  I have tried everything I can think of to try to get them 
> back - like restarting xCode, opening different files etc.

When a single file is opened the default is no toolbar, no left side navigator, 
and no right side utilities.

When a project is opened then you should get everything. Does this happen when 
you open a brand new project?

You can reset an existing project by opening the xcodeproj bundle and 
discarding the xcworkspace bundle and xcuserdata folder. Keep the pbxproj 
bundle.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-05-06 Thread Richard Charles
I have a custom NSNumberFormatter which does validation. If I bind the text 
field using NSValueBinding then when validation fails an alert panel will 
automatically appear. However it is the binding machinery that brings up the 
alert panel. Apple integrates bindings with user interface elements using a ton 
of private classes.

If you have a custom binding then the primary method at your disposal is 
bind:toObject:withKeyPath:options: which for a custom binding has no 
integration user interface elements. The binding is only one-way, model changes 
are pushed to the view but the view must manually push changes back to the 
model. So in addition to writing code to push view changes to the model you 
must also write code to present an error alert panel and discard a change.

--Richard Charles

> On May 6, 2019, at 7:49 AM, Keary Suska  wrote:
> 
> IIRC, you get this behavior automatically when validating with a formatter, 
> so applying a custom NSNumberFormatter subclass might be more canonical and 
> less kludgey.
> 
> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
>> On May 6, 2019, at 5:33 AM, Richard Charles  wrote:
>> 
>> Thank you Quincey, Sean, Gary and Alex for your comments and suggestions.
>> 
>> To recap I have a NSTextField subclass bound to an array controller using a 
>> derived value binding. The user selects one or more objects in a graphic 
>> view. Object properties are shown in an inspector containing the text field.
>> 
>> A custom derived value binding is needed because object properties are 
>> floating point values with limited precision. Values that are close to equal 
>> are considered equal from the user's point of view.
>> 
>> When garbage is entered into a text field and the user presses the return 
>> key an alert panel is presented as a sheet attached to the window. The user 
>> can choose "Discard Change" or "OK”.
>> 
>> Because a custom binding is used code must be added to present the error and 
>> recover from the error. My text field subclass implements the 
>> NSErrorRecoveryAttempting informal protocol.
>> 
>> My original discard change code did not work.
>> 
>> - (void)attemptRecoveryFromError:(NSError *)error
>> optionIndex:(NSUInteger)recoveryOptionIndex
>>delegate:(id)delegate
>>  didRecoverSelector:(SEL)didRecoverSelector
>> contextInfo:(void *)contextInfo
>> {
>>// Discard Change
>>if (recoveryOptionIndex == 1) {
>>[self abortEditing]; // does not work
>>}
>> }
>> 
>> Here is a solution that works well.
>> 
>> - (void)attemptRecoveryFromError:(NSError *)error
>> optionIndex:(NSUInteger)recoveryOptionIndex
>>delegate:(id)delegate
>>  didRecoverSelector:(SEL)didRecoverSelector
>> contextInfo:(void *)contextInfo
>> {
>>// Discard Change
>>if (recoveryOptionIndex == 1) {
>>    // Revert display back to original value.
>>[self abortEditing];
>>[self setObjectValue:self.cachedObjectValue];
>>[self.window makeFirstResponder:self];
>>}
>> }
>> 
>> The abortEditing message is needed otherwise the binding will push the 
>> updated cached object value to the model.
>> 
>> --Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-05-06 Thread Richard Charles
Thank you Quincey, Sean, Gary and Alex for your comments and suggestions.

To recap I have a NSTextField subclass bound to an array controller using a 
derived value binding. The user selects one or more objects in a graphic view. 
Object properties are shown in an inspector containing the text field.

A custom derived value binding is needed because object properties are floating 
point values with limited precision. Values that are close to equal are 
considered equal from the user's point of view.

When garbage is entered into a text field and the user presses the return key 
an alert panel is presented as a sheet attached to the window. The user can 
choose "Discard Change" or "OK”.

Because a custom binding is used code must be added to present the error and 
recover from the error. My text field subclass implements the 
NSErrorRecoveryAttempting informal protocol.

My original discard change code did not work.

- (void)attemptRecoveryFromError:(NSError *)error
  optionIndex:(NSUInteger)recoveryOptionIndex
 delegate:(id)delegate
   didRecoverSelector:(SEL)didRecoverSelector
  contextInfo:(void *)contextInfo
{
 // Discard Change
 if (recoveryOptionIndex == 1) {
 [self abortEditing]; // does not work
 }
}

Here is a solution that works well.

- (void)attemptRecoveryFromError:(NSError *)error
  optionIndex:(NSUInteger)recoveryOptionIndex
 delegate:(id)delegate
   didRecoverSelector:(SEL)didRecoverSelector
  contextInfo:(void *)contextInfo
{
 // Discard Change
 if (recoveryOptionIndex == 1) {
 // Revert display back to original value.
 [self abortEditing];
 [self setObjectValue:self.cachedObjectValue];
 [self.window makeFirstResponder:self];
 }
}

The abortEditing message is needed otherwise the binding will push the updated 
cached object value to the model.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-04-27 Thread Richard Charles
> On Apr 9, 2019, at 9:40 AM, Sean McBride  wrote:
> 
> NSTextField in fact does *not* support commitEditing/discardEditing, as per 
> this a decade ago:
> 
> <https://lists.apple.com/archives/cocoa-dev/2008/Aug/msg00529.html>
> 
> I don't think I ever did find another solution to my problem other than to 
> use an NSObjectController.


My testing shows you are correct. Contrary to the documentation NSTextField 
does not support the NSEditor protocol. No App Kit user interface elements that 
I can find support this protocol. It is only supported by NSController and 
NSViewController.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-04-27 Thread Richard Charles
> On Apr 7, 2019, at 11:03 AM, Quincey Morris 
>  wrote:
> 
>> On Apr 5, 2019, at 20:55 , Richard Charles  wrote:
>> 
>> Sending the text field an abortEditing message does not work. How can 
>> changes to the text field be discarded?
> 
> Caveat: I don’t know the answer to what you’re asking, but I suspect you may 
> be asking the wrong question.
> 
> First of all, what does “does not work” mean?


Sending the text field an abortEditing message results in no changes to the 
text field. Nothing happens.


> Second, looking at the documentation here:
> 
> https://developer.apple.com/documentation/appkit/nscontrol
> 
> the “abortEditing” method is listed under “Managing the Field Editor”. I 
> suspect it’s actually used internally to manage the relationship between the 
> text field’s cell and the field editor, and not to manage the editing state 
> of the control as a while. This method is probably just the wrong hammer for 
> this nail.
> 
> Third, what I think you’re looking for is “discardEditing”, which is a part 
> of the NSEditor protocol, to which NSTextField conforms. However, I’m not 
> entirely sure about timing, whether it’s reasonable to invoke in response to 
> “attemptRecoveryFromError:…”. But maybe.


According to macOS 10.13 documentation (NSKeyValueBinding.h) discardEditing is 
implemented by controllers, CoreData's managed object contexts, and user 
interface elements.

However upon searching the macOS SDK, discardEditing is only implemented by by 
NSController and NSViewController. It is not implemented by any user interface 
elements. Testing has confirmed that NSTextField does not implement 
discardEditing.

Sending the array controller bound to the text field a discardEditing message 
does’t work either. Nothing happens. Switching back to a standard cocoa value 
binding and placing symbolic breakpoints on -[NSController discardEditing] and 
-[NSArrayController discardEditing] shows that when the user clicks "Discard 
Change" in the alert panel, discardEditing is never called. So the cocoa 
frameworks are using some other means to discard the change from the text field.


> Note that the documentation for NSEditor shows its methods as deprecated:
> 
> https://developer.apple.com/documentation/appkit/view_management/nseditor
> 
> I believe this is a documentation error. At some point, NSEditor was 
> converted from an informal protocol to a formal protocol (so it would 
> translate into Swift properly), and that causes this error in the 
> documentation. If you look at the actual header file (NSKeyValueBinding.h), 
> you can see that the formal NSEditor protocol has no deprecations:
> 
>> @protocol NSEditor 
>> 
>> - (void)discardEditing;// …
>> - (BOOL)commitEditing;// …
> 
> as well as the deprecations of the information protocol methods:
> 
>> @interface NSObject (NSEditor)
>> - (void)discardEditing NS_DEPRECATED_MAC(10_0, API_TO_BE_DEPRECATED, "This 
>> is now a method of the NSEditor protocol.");
>> - (BOOL)commitEditing NS_DEPRECATED_MAC(10_0, API_TO_BE_DEPRECATED, "This is 
>> now a method of the NSEditor protocol.”);


In summary testing has shown that discardEditing messages are sent to 
controllers which are bound to a text field during normal operation. But when 
the user chooses "Discard Change" in an alert panel a discardEditing message is 
never sent. The frameworks are using some other means to discard the change 
from the text field.

So this all is a bit of a mystery how to programmatically discard a change from 
a text field bound to an array controller.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-04-08 Thread Richard Charles
Quincey, thanks so much for your insight. Unfortunately I will be gone for the 
next several weeks. I thought I would be able to tackle this problem before I 
left but now I have run out of time. I will be able to look more carefully at 
your comments when I get back. Thanks again.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dynamically change NSCollectionView items based on view width

2019-04-06 Thread Richard Charles
Cocoa Programming for Mac OS X Third Edition by Aaron Hillegass, Chapter 29 
View Swapping.

Cocoa Programming for Mac OS X Fourth Edition by Aaron Hillegass, Chapter 31 
View Swapping.

Cocoa Programming for Mac OS X Fifth Edition by Aaron Hillegass, Chapter 31 
View Swapping and Custom Container View Controllers.

--Richard Charles

> On Apr 6, 2019, at 3:46 PM, Demitri Muna  wrote:
> 
> Hello,
> 
> I have a 10.11+ NSCollectionView. I have two representations (subclasses of 
> NSCollectionViewItem) of the data - one large and one small. When the view is 
> resized to be narrower than the large representation, I’d like to swap the 
> views to the smaller versions. Similarly, when the window is widened enough 
> to accommodate at least a single of the larger views, I’d like the views to 
> change again. I’ve not been able to make this work.
> 
> I have set up an NSViewBoundsDidChangeNotification so I know when the width 
> of the view crosses the threshold. I’ve tried:
> 
> - [collectionView reloadData]
> - [collectionView.collectionViewLayout invalidateLayout] (on the 
> NSCollectionViewFlowLayout)
> 
> I think I just want to invalidate all of the already created views and get 
> the collection view to call makeItemWithIdentifier:forIndexPath: again.
> 
> One option I haven’t explored is to handle the change within a single 
> NSCollectionViewItem subclass (two views in the one .xib), but since the 
> representations are sufficiently different (e.g different number of subviews) 
> I’m worried about running into auto layout issues during the transition. Also 
> it feels messier.
> 
> Bonus points for how to accomplish this with animation!
> 
> Thanks,
> Demitri


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextField "Discard Change"

2019-04-05 Thread Richard Charles
In a document window enter garbage into a text field and press return. An alert 
panel will be presented as a sheet attached to the window. In the alert panel 
the user can choose "Discard Change" or "OK".

So far so good.

In my case I have a text field subclass with a derived value custom binding. 
The text field implements the NSErrorRecoveryAttempting informal protocol.

- (void)attemptRecoveryFromError:(NSError *)error
 optionIndex:(NSUInteger)recoveryOptionIndex
delegate:(id)delegate
  didRecoverSelector:(SEL)didRecoverSelector
 contextInfo:(void *)contextInfo
{
// Discard Change
if (recoveryOptionIndex == 1) {
[self abortEditing]; // does not work
}
}

Sending the text field an abortEditing message does not work. How can changes 
to the text field be discarded?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSManagedObject.managedObjectContext is nil???

2019-03-26 Thread Richard Charles
You have retained the managed object outside the managed object context.

--Richard Charles


> On Mar 26, 2019, at 1:04 PM, Rick Mann  wrote:
> 
> I'm seeing a situation where my NSManagedObject's managedObjectContext is 
> nil. It doesn't happen all the time though. Any idea why? Thanks!
> 
> -- 
> Rick Mann
> rm...@latencyzero.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: printing black

2019-01-22 Thread Richard Charles

> On Jan 22, 2019, at 1:16 AM, Georg Seifert  wrote:
> 
> Hi
> 
> I have a app that can print black shapes (using normal cocoa view based 
> printing). A lot users complain that the printouts are not really black (the 
> printouts are rastered, so the color sync tries to simulate a CMJK black but 
> even thou that it is black already). 
> 
> We played around with the pdf made form the print dialog. Printing that from 
> Adobe Acrobat produces the same results. But Acrobat has an option to convert 
> the PDF to optimise it for Digital printing. It attaches a genericGrayscale 
> profile to the PDF. 
> 
> Does any have a hint what to do? 
> 
> Thanks
> Georg

The Mac has not handled monochrome black & white printing correctly for 
decades. I wrote an Automation action to repetitively apply a “Lightness 
Decrease” quartz filter to pdf documents that effectively changes a color pdf 
into a black & white monochrome pdf. It works well.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: lockFocusIfCanDraw behavior in layer-backed mode

2018-12-17 Thread Richard Charles

> On Dec 16, 2018, at 6:34 PM, Tor Arne Vestbø  wrote:
> 
> The session doesn’t go into what do if you want to draw synchronously outside 
> of the display cycle though. Is it enough to setNeedsDisplay and then call 
> [NSView displayIfNeeded] or [CALayer displayIfNeeded]? I guess the latter 
> since I don’t want AppKit to walk the view hierarchy and display other views 
> (unless it’s smart enough to treat a layer-backed view as not needing that 
> behavior).

Yes, the session does not go very deep. Here are some of my notes on the 
subject which may or may not be helpful.

Generally speaking there are three ways to execute draw code. You can use a 
timer-based mode where it will execute draw code at a regular interval in 
synchronization with a display. You can use an event-based mode which will 
trigger draw code whenever an event has occurred. Finally, you can explicitly 
drive the draw code, perhaps in an open loop on a secondary thread at your own 
frame rate.

My application uses the second approach. Draw code is triggered whenever an 
event has occurred. However dynamic resources may be concurrently generated on 
demand on a background thread. Also the main layer may be drawn using a texture 
generated by a background thread. Concurrent drawing is coordinated with 
setNeedsDisplay using a run loop observer on the main thread. When it is 
necessary to display the layer, simply call setNeedsDisplay on the layer.

Lili Sang, Apple DTS Engineer, was helpful in providing insight. You may want 
to submit a technical support incident on your particular use case.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: lockFocusIfCanDraw behavior in layer-backed mode

2018-12-15 Thread Richard Charles

> On Dec 15, 2018, at 8:07 AM, Tor Arne Vestbø  wrote:
> 
> Piggy-backing on this thread, what does lockFocusIfCanDraw actually do in 
> layer-backed mode?

I have a layer-hosting view running under macOS 10.12.6 and lockFocus is called 
by the system frameworks.

#0  0x0001000748f4 in -[MyView lockFocus]
#1  0x7fffc0544e7b in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#2  0x7fffc05456d1 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#3  0x7fffc05456d1 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#4  0x7fffc05456d1 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#5  0x7fffc05442af in -[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#6  0x7fffc05426d8 in -[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#7  0x7fffc053dfca in -[NSView displayIfNeeded]
#8  0x7fffc053d8db in -[NSWindow displayIfNeeded]

WWDC 2018 Session 209 states the following.

"With our changes to layer backing, there's a few patterns I want to call out 
that aren't going to work in macOS 10.14 anymore. If you're using NSView 
lockFocus and unlockFocus, or trying to access the window's graphics contents 
directly, there's a better way of doing that. You should just subclass NSView 
and implement draw rect. Both of those methods have been kind of finicky for a 
while. So, you'll be saving yourself some trouble."

Note that all of the NSView focus methods are now depreciated.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom NSButton image effects for pressed/disabled

2018-12-13 Thread Richard Charles

> On Dec 12, 2018, at 5:31 PM, Lars C. Hassing  wrote:
> 
> The button should look like
> 
> +---+ +---+
> | 1 |  Title  | 2 |
> +---+ +—+
> 
> (try using Courier for the ASCII art)
> 
> I am looking for system functions to produce the SAME look and feel as Cocoa 
> controls.

Compose your image as a single image but with disjointed parts. I use Inkscape 
to draw vector graphics and use a pdf for the image. The only place in the 
"image" where there is something is where something is drawn. Everywhere else 
it is just an empty background.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need a direction. App crash in CoreData while loading a window's nib

2018-11-04 Thread Richard Charles


> On Nov 4, 2018, at 1:42 AM, Motti Shneor  wrote:
> 
> I just do not know how to go about resolving this.

Here is another idea. Remove your bindings one at a time. Perhaps it is just 
one binding that is causing the problem and then you can perhaps track it from 
there. It looks like this may be some kind of KVO problem.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need a direction. App crash in CoreData while loading a window's nib

2018-11-03 Thread Richard Charles


> On Nov 3, 2018, at 2:47 PM, Motti Shneor  wrote:
> 
> Can anyone suggest a way to start bisecting the issue or an idea where to 
> look for?

You may have bad or corrupted data in your core data persistent store. Save the 
file out as an xml and see if you find anything suspicious. 

You could also open the sqlite file with the Base.app by Menial and see what 
happens and take a look at the data.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode 10 and disable layer backed windows in Mojave

2018-10-25 Thread Richard Charles

> On Oct 25, 2018, at 6:31 AM, Georg Seifert  wrote:
> 
> When I build my app with Xcode 10, Mojave uses the new layer backed windows. 
> My view drawing is (not yet) able to dealt with layer backed views.

NSWindow has a content view and a view and can be layer backed. NSView has 
supported layer backing since OS X 10.5.

> So is there a way to disable the new window system? The only way I fond is 
> not to link against the 10.14 SDK. But that is the SDK Xcode 10 is using even 
> in 10.13.

AppKit Release Notes for macOS 10.14

"Windows in apps linked against the macOS 10.14 SDK are displayed using Core 
Animation when the app is running in macOS 10.14. This doesn’t mean that all 
views are layer-backed; rather, it means that all views are either layer-backed 
or draw into a shared layer with other layers.”

The release notes say nothing about this behavior being optional.

> Is there a way to link against the 10.13 SDK in Xcode 10. Any other ideas?

Not sure about linking but I think you need to make your views compatible with 
layer backing.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: touchesMoved value setting

2018-09-18 Thread Richard Charles

> On Sep 18, 2018, at 6:44 AM, Eric E. Dolecki  wrote:
> 
> I have a UI control that can be adjusted up and down using touch & drag.
> I've been asked to provide a control value based on how far the drag is via
> distance. So far so good.
> 
> What my designer wants is a value change of every 20 pixels or so (control
> is 150px tall @ the moment) - so every 20 pixels = a change of 1.

I think you mean points not pixels.

Not familiar with UI controls but this sounds very similiar to NSSlider.

 – maxValue
 – minValue

 – setMaxValue:
 – setMinValue:

> This will require multiple touch and drags but he's fine with it.

This does not sound right. I think something is wrong.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSAlert

2018-09-10 Thread Richard Charles


> On Sep 10, 2018, at 12:17 PM, Ben Kennedy  wrote:
> 
> Son of a gun. Thanks for elucidating this Richard.

Actually Andy Lee was right on when he suggested "it may depend on the setting 
in System Preferences that governs whether all controls can get keyboard 
focus". However I could not see what "All controls" had to do with pressing the 
spacebar so I stumbled upon my insight independently of Andy's comment.

Apple could do a better job of documenting this behavior somewhere for 
developers and users.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSAlert

2018-09-10 Thread Richard Charles


> On Sep 8, 2018, at 6:25 PM, Andy Lee  wrote:
> 
> I don't know where or whether it's documented, but it's not new.
> Using Space for "clicking" whichever control has focus has been around
> for a while.  I don't remember offhand -- it may depend on the setting
> in System Preferences that governs whether all controls can get
> keyboard focus.


> On Sep 8, 2018, at 6:52 PM, Alex Zavatone  wrote:
> 
> Which version of macOS are you running?


Thanks for the comments.

On my development machine running 10.12.6 pressing the spacebar will dismiss a 
simple NSAlert. This is because in System Preferences > Keyboard > Shortcuts > 
Full Keyboard Access > All Controls was selected. (For some reason it took 
forever to discover this.)

When "All Controls" is selected the control with focus will have a focus ring 
drawn around it and pressing the spacebar will "click" the control with focus. 
Also pressing the tab key will move the keyboard focus between controls.

Setting a control key equivalent to the return key will make it the default 
control and it will be blue. The default control can be "clicked" by pressing 
the return key.

One common place where you can see all of this in action is in the alert when 
emptying the trash in Finder.

At one time this may have been all in my muscle memory but if you have been 
using your iPhone day in and day out for the last many years then you may need 
a referesher.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSAlert

2018-09-08 Thread Richard Charles
I have a simple NSAlert presented as an attached sheet with a single default OK 
button.

When the spacebar is pressed the alert is dismissed.

It this a new thing?

Is this documented anywhere?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mac App Store paid upgrades and app settings

2018-08-13 Thread Richard Charles


> On Aug 13, 2018, at 10:17 AM, Martin Wierschin  wrote:
> 
> The new version is to be a paid upgrade, which I know the MAS doesn't really 
> support.

It has been reported that Microsoft Office 365 and Adobe Lightroom are coming 
to the new Mac App Store. Those apps surely are not single time payment apps. 
So does this mean that the new Mac App Store will allow for upgrade payments or 
recurring payments? Perhaps Apple, Microsoft and Adobe know the answer to that 
question but are not telling anyone.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Richard Charles


> On Jul 25, 2018, at 6:18 PM, Casey McDermott  wrote:
> 
> One big beef I have is that it's not possible to step into Cocoa source, 
> unlike PowerPlant
> or MFC.  It makes it much harder to understand what's going on inside Cocoa.

Check out the Cocotron source. Sometimes you can gain insight into what going 
on by looking there.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why are the simplest things the hardest?

2018-07-07 Thread Richard Charles

> On Jul 6, 2018, at 10:55 PM, Rick Mann  wrote:
> 
> If I have view commands (like fixed perspectives in a 3D view) in a menu, I 
> should be able to implement those on the view controller, don't you think?

It depends if the view controller is in the responder chain for the object in 
question.

The documentation indicates that in macOS 10.10 and later, a view controller 
does participate in the responder chain.

Cocoa Design Patterns by Buck and Yacktman, Chapter 18 Responder Chain, The 
Extended Responder Chain page 223 is a great read on the subject. I can’t find 
my book right now but I think they have sample code that will walk the 
responder chain, log this to the console, and you can then see exactly what 
your responder chain looks like. I find this to be a great debugging tool.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to make my NSViewControllers participate in responder chain?

2018-06-30 Thread Richard Charles


> On Jun 30, 2018, at 3:46 AM, Rick Mann  wrote:
> 
> I have a complex view hierarchy with a lot of controllers. I'd like to 
> provide menu commands that the various controllers can respond to, but I have 
> a couple of problems:
> 
> 1) I can't seem to get any of my view controllers (even the window's root 
> view controller) to participate, even if I override acceptsFirstResponder to 
> return true.
> 2) What happens when I have sibling view controllers (e.g. in a split view 
> controller)? I'd like all of them to participate, if they can.
> 
> I can, of course, push all that stuff up to the root view controller, but 
> that makes me do things like subclass NSSplitViewController.
> 
> The whole thing seems cumbersome, at best. What am I missing?
> 
> Thanks,
> 
> -- 
> Rick Mann


I have an app with lots of views and a ton of custom controllers. If one of the 
controllers is not in the responder chain but needs to be this is what I do.

@property (readonly, retain) MyResponder *responder;

// During initialization of my view which is already in the responder chain
// insert custom object into the responder chain. Refer to Cocoa Event
// Handling Guide, Event Architecture, The Responder Chain.
MyResponder *customObject = _responder;
NSResponder *nextResponder = self.nextResponder;
[self setNextResponder:customObject];
[customObject setNextResponder:nextResponder];

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Scrolling differences when using Trackpad or Mouse-Wheel

2018-06-23 Thread Richard Charles


> On Jun 19, 2018, at 3:56 AM, Michael Starke 
>  wrote:
> 
> I'm currently trying to find the bottleneck in my app MacPass that's causing 
> the scrolling in the main table to be sluggish.
> 
> Before diving deeply into Instruments to find the culprit I realized that 
> scrolling with the trackpad is butter-smooth but scrolling using the mouse 
> wheel is rather slow. When I start to scroll down, there's a slight delay but 
> then the scrolling works smooth. This is not the case when scrolling up or 
> when scrolling using the trackpad.


I downloaded MacPass 0.7.3 and created a new document with 200 entries in what 
I believe to be the MPTableView. I tried scrolling with a Logitech M510 mouse 
wheel using the standard apple driver (no custom driver installed). I also 
tried scrolling with track pad on a MacBook Air.

Normally a mouse wheel with detents will have acceleration when scrolling but 
no momentum. Normally trackpad will have momentum when scrolling. This behavior 
can be seen when scrolling in TextEdit, Contacts, and Mail.

When scrolling in MacPass with a mouse wheel the initial delay I believe is due 
to acceleration which appears to be normal. However when mouse wheel movement 
has stopped scrolling still persists for a short period of time almost 
appearing to be momentum. This is not normal. A mouse wheel has no momentum if 
it has detents. So this is a puzzle.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Scrolling differences when using Trackpad or Mouse-Wheel

2018-06-20 Thread Richard Charles

> On Jun 20, 2018, at 5:53 AM, Michael Starke 
>  wrote:
> 
> I'm using a Logitech mouse without any additional drivers installed.
> 
> I tried using a couple of Logitech mouses, directly attached to the Laptop, 
> attached to the Hub inside the monitor, nothing changes. Every mouse behaves 
> the same way that is, it's lagging on the initial scroll.
> 
> I'll try to find some more mice from different vendors to see if this makes 
> any difference. And I'll run Instruments to see if I can identify the 
> bottleneck.

I just download the MacPass application to test the scrolling repose with a 
mouse wheel.

https://github.com/MacPass/MacPass/releases

I launched the application and got the following alert.

“MacPass” can’t be opened because it is from an unidentified developer. Your 
security preferences allow installation of only apps from the App Store and 
identified developers.

Why is this app not signed with a developer certificate?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UNIX error exception: 17

2018-06-08 Thread Richard Charles
I have a document based core data application. When ever the application 
launches the following messages appear in the Console app.

default 19:45:53.391888 -0600   MyApp   UNIX error exception: 17
default 19:45:53.392367 -0600   MyApp   0x60268a40 opened 
/private/var/db/mds/system/mdsDirectory.db: 50744 bytes
default 19:45:53.393995 -0600   MyApp   UNIX error exception: 17
default 19:45:53.394243 -0600   MyApp   UNIX error exception: 17

When the app is launched from within Xcode the debug area is blank.

Any idea what could be causing this?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Persistent User Defaults

2018-04-24 Thread Richard Charles
On macOS an applications user defaults are stored in a preference plist file 
located in ~/Library/Preferences.

If this file is deleted, user preferences for the application still persist 
until the machine is rebooted. In other words if you want to start with a clean 
set of user preferences not only must you delete the preference plist file but 
you must also restart the machine.

Can anyone shed light on this behavior?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deleting files extremely slow since OSX High sierra

2018-04-22 Thread Richard Charles
> On Apr 22, 2018, at 8:48 PM, Steve Mills  wrote:
> 
> There’s definitely something rotten in 10.13. After a few days of using 
> Safari, closing windows or doing new searches will take around 30 seconds. 
> Quicklooking jpgs in Finder will become sluggish. Only a robot seems to fix 
> it for a few days, then everything starts slowing down again, getting worse 
> and worse as the days go on.

It looks like others are also experiencing slow issues with High Sierra.

https://discussions.apple.com/thread/8155686

> On Nov 10, 2017 thadwald wrote:
> 
> imac unusably slow after high sierra upgrade 
> 
> i have a 2014 27" i7 retina imac. it has slowed to the point of being 
> unusable after upgrading to high sierra. simply opening finder takes more 
> than 5 minutes before the files are done displaying and the beachball stops.

This sounds exactly like what happened to my High Sierra machine on Friday (2 
days ago). This was a clean machine. Very little had been done on the machine 
since a clean install of High Sierra about one month ago. It happened all of a 
sudden when I was messing around with file sharing. It was so bad that the only 
thing I could think of doing was another clean install.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deleting files extremely slow since OSX High sierra

2018-04-22 Thread Richard Charles
> On Apr 22, 2018, at 1:55 PM, Vojtěch Meluzín  
> wrote:
> 
> Since OSX High sierra deleting these files became extremely slow, almost like 
> the OSX is checking the bundles after every change.

I have a test machine running High Sierra 10.13.4. Just on Friday I was doing 
some network testing for a friend, connecting a Windows 10 machine to a macOS 
High Sierra shared folder. The Mac became extremely sluggish. Every operation 
that touched the file system became extremely slow even after turning file 
sharing off. I have never experienced anything like this before. I ended up 
reinstalling High Sierra to get rid of the problem.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Harmful Notification Post Rate

2018-03-30 Thread Richard Charles
> On Mar 29, 2018, at 10:49 PM, Quincey Morris 
>  wrote:
> 
> On Mar 29, 2018, at 21:00 , Richard Charles  wrote:
>> 
>> How can I figure out what notification is posting at a high rate?
> 
> Not sure, but have you turned on “NSWindow.acceptsMouseMovedEvents” by any 
> chance?

I have not called -[NSWindow acceptsMouseMovedEvents]. My custom view 
implements -[NSResponder mouseMoved:] but the frameworks never call this method 
during a mouse drag.

My custom view implements -[NSResponder mouseDragged:] but this has never 
caused any problems. When I turn on custom logging for mouseDragged: I get 
following output.

Mouse Dragged Rate: 125.7 events per second
Mouse Dragged Rate: 124.1 events per second
Mouse Dragged Rate: 124.2 events per second
Mouse Dragged Rate: 124.8 events per second
Mouse Dragged Rate: 125.2 events per second
Mouse Dragged Rate: 124.6 events per second
Mouse Dragged Rate: 168.3 events per second
2018-03-30 12:58:01.798960-0600 Xsolid[72930:1753914] Detected potentially 
harmful notification post rate of 112.994 notifications per second

This is confusing because several years ago I turned on custom logging and 
recorded that AppKit would throttle NSLeftMouseDragged events to a maximum of 
about 60.0 events per seconds but that obviously is not the case now.

To try and track down the problem I implemented notification logging by 
swizzling the following methods.

-[NSNotification postNotification:]
-[NSNotification postNotificationName:object:]
-[NSNotification postNotificationName:object:userInfo:]

Here is the output when dragging with the mouse in the custom view. I manually 
formatted the output with blank lines after the fact to make it more readable.

NotificationName  TimeIntervalInSeconds
===

NSApplicationWillBecomeActiveNotification   986.597
NSApplicationWillBecomeActiveNotification   986.597
NSApplicationDidBecomeActiveNotification986.597
NSApplicationDidBecomeActiveNotification986.597
NSWindowDidBecomeMainNotification   986.602
NSWindowDidBecomeMainNotification   986.602

MyDocumentWindowDidActivate 986.602
MyDocumentWindowDidActivate 986.602

NSMenuDidChangeItemNotification 986.602
NSWindowDidBecomeKeyNotification986.609
NSWindowDidBecomeKeyNotification986.609

NSGestureEventMaskChanged   986.611
NSGestureEventMaskChanged   986.611

NSApplicationWillUpdateNotification 986.633
NSApplicationWillUpdateNotification 986.633
NSWindowDidUpdateNotification   986.633
NSWindowDidUpdateNotification   986.633
NSApplicationDidUpdateNotification  986.633
NSApplicationDidUpdateNotification  986.633

NSApplicationWillUpdateNotification 986.635
NSApplicationWillUpdateNotification 986.635
NSWindowDidUpdateNotification   986.635
NSWindowDidUpdateNotification   986.635
NSApplicationDidUpdateNotification  986.635
NSApplicationDidUpdateNotification  986.635

NSApplicationWillUpdateNotification 986.723
NSApplicationWillUpdateNotification 986.723
NSWindowDidUpdateNotification   986.723
NSWindowDidUpdateNotification   986.723
NSApplicationDidUpdateNotification  986.723
NSApplicationDidUpdateNotification  986.723

NSApplicationWillUpdateNotification 986.723
NSApplicationWillUpdateNotification 986.723
NSWindowDidUpdateNotification   986.723
NSWindowDidUpdateNotification   986.723
NSApplicationDidUpdateNotification  986.723
NSApplicationDidUpdateNotification  986.723

NSApplicationWillUpdateNotification 987.739
NSApplicationWillUpdateNotification 987.739
NSWindowDidUpdateNotification   987.739
NSWindowDidUpdateNotification   987.739
NSApplicationDidUpdateNotification  987.739
NSApplicationDidUpdateNotification  987.739

NSApplicationWillUpdateNotification 987.745
NSApplicationWillUpdateNotification 987.745
NSWindowDidUpdateNotification   987.745
NSWindowDidUpdateNotification   987.745
NSApplicationDidUpdateNotification  987.745
NSApplicationDidUpdateNotification  987.745

2018-03-30 12:23:07.850854-0600 MyApp[72672:1742782] Detected potentially 
harmful notification post rate of 102.59 notifications per second

My code does not call any of these notifications except 
MyDocumentWindowDidActivate so this is very puzzling.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Harmful Notification Post Rate

2018-03-29 Thread Richard Charles
When dragging the mouse the console will issue a warning "Detected potentially 
harmful notification post rate of xxx.xxx notifications per second".

How can I figure out what notification is posting at a high rate?

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSLayoutConstraint crash

2018-03-16 Thread Richard Charles

> On Mar 16, 2018, at 9:03 AM, David Catmull  wrote:
> 
> After I set up a somewhat complex view hierarchy, I'm getting a crash with
> this exception:
> 
> 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion failure
> in -[NSLayoutConstraint setPriority:],
> /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222
> 
> It happens on the main event loop where none of my code is involved; I
> never set constraint priorities myself. What could be causing this error?

Have you tried manually exercising the constraints? In Interface Builder drag 
the views into random positions and sizes then click "Update Frames” to force 
the constraint system to apply the constraints. This may uncover any errors you 
have in the constraints containted in the view hierarchy.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSLayoutConstraint crash

2018-03-16 Thread Richard Charles

> On Mar 16, 2018, at 9:03 AM, David Catmull  wrote:
> 
> After I set up a somewhat complex view hierarchy, I'm getting a crash with
> this exception:
> 
> 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion failure
> in -[NSLayoutConstraint setPriority:],
> /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222
> 
> It happens on the main event loop where none of my code is involved; I
> never set constraint priorities myself. What could be causing this error?

Perhaps this might help.

https://books.google.com/books?id=JTxsAQAAQBAJ&pg=PP51&lpg=PP51&dq=Assertion+failure+NSLayoutConstraint+setPriority&source=bl&ots=5hS5MqkC4F&sig=RZENjGG10if2pqw9_RKTbJhTQQA&hl=en&sa=X&ved=0ahUKEwjJhrm6m_HZAhVM6WMKHU0wCogQ6AEIZjAI#v=onepage&q&f=false

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode Versions

2018-01-20 Thread Richard Charles

> On Jan 20, 2018, at 7:37 AM, LAURENT Charles  
> wrote:
> 
> 
> Hello !
> 
> 
> 
>  Since a long Time ,  I would have been a programmer !
>  But   Apple runs  to fast   for me .
>  Books cannot  follow  XCode Versions …….
>  I   got  an excellent  book  : macOS Programming for
>  Absolute Beginners 2017  Wallace Wang 
> Please ,  Anyone  could  let me Knowthe Xcode 
> version  I  need  which
> could fit that book , on an iMac 2017 high Sierra
> 
>  Thank you  very much
> 
> 
> 
> Charles LAURENT
> charleslaur...@wanadoo.fr



The title of chapter two is "Getting to Know Xcode 8” so I assume you would run 
Xcode 8.3.3 which should run fine under macOS High Sierra. By the way how did 
you end up with all those leading spaces at the begining of each line in your 
email.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Popup-Menu Binding issue in Cell-based NSTableView

2018-01-01 Thread Richard Charles
Your example is difficult to follow. You may need to post the actual project or 
a similar project online to get helpful feedback.

From the documentation: "NSArrayController is a bindings compatible class that 
manages a collection of objects. Typically the collection is an array, however, 
if the controller manages a relationship of a managed object the collection may 
be a set.” If what you are trying to do falls within the scope of this 
statement it should work correctly, if not it won’t.

NSArrayController will not manage a Core Data relationship. It manages a single 
collection of objects which may be an array or in the case of a Core Data 
relationship a set of objects. This single collection may be sorted, filtered 
and members of the collection may be selected. You can also set the class of 
objects that make up the content and then add and remove objects of that type 
to and from the collection.

So NSArrayController works within a very narrow range of capabilities.

--Richard Charles

> On Jan 1, 2018, at 2:46 AM, Motti Shneor  wrote:
> 
> Hello everyone. Please excuse the anachronism, I am maintaining an old Mac 
> Application written early 2014 when Swift was not an option.  Pure Obj-C, 
> CoreData, and “No-custom-UI” approach.
> 
> I have an NSCell based NSTableView, whose columns are bound to an 
> NSArrayController, whose Content-Array in turn is bound to some CoreData 
> to-many relation - thus the table shows all the related entities.
> 
> Say we have a “WaterSample” entity, and the to-many relation is called 
> “measurements” and each Measurement has length, width, depth, colony-size and 
> species properties - each bound to one of the NSTableColumns. So far - the 
> very basic and stranded use of binding.
> 
> Of the Measurement properties - the species - is yet another to-one relation 
> to the  “Species” table. To allow the user to edit/change the species of a 
> Measurement (line in the table) I have placed a Popup Button Cell in the 
> “Species” column, and bound it like this:
> 
> Content  bound to Species Array Controller, Controller Key: arrangedObjects, 
> Content Placement Tag: 0
> Content Values  bound to Species Array Controller, Controller Key: 
> arrangedObjects, Model Key Path: codeAndName, Content Placement Tag: 0,  
> Multiple Values Placeholder: Multiple Species
> Selected Object  bound to Measurements Array Controller, Controller Key: 
> arrangedObjects, Model Key Path: species, Allows Editing Multiple Values 
> Selection, Conditionally Sets Enabled, Creates Sort Descriptor
> 
> Now it SEEMS to KIND-OF work, (I see the species codes and names, user can 
> click the popup button on each row to see and select from all our Species, 
> and even change the species to another one.
> 
> But I have these issues:
> 
> 1. When I select several Measurement rows of the table — All with the same 
> Species— and click the popup button on any row - it shows “Multiple Species” 
> as the selected value - although all rows have the same species selected.
> 
> 2. Selecting a species only applies to the row where I clicked the popup 
> button - not to all selected rows. After releasing the mouse the selection 
> reduces to just one row - but it is terribly confusing.
> 
> 3. The editing is immediate, via binding, and I did not find any place to 
> interfere (Say I need to re-calculate things as species changed, or even 
> prevent the change if the newly-selected  species is not compatible with the 
> original.
> 
> I have set up a menu Action to the popup-button-cell - and it is called - but 
> the change is already done in the model.
> 
> My questions: 
> Is there anything wrong in my binding settings?
> When the content of a popup-button-cell is populated by binding - Can I still 
> apply NSMenu Validation protocol to that menu, and Filter/Enable/Disable menu 
> items as user clicks to open the menu?
> When the editing is done via the “Selected Object” binding - can I still 
> somehow intervene and “Catch” the change in code before it happens?
> 
> Any hint will be appreciated - and - Happy new year everyone.
> 
> 
> Motti Shneor
> ---
> ceterum censeo microsoftiem delendam esse
> ---

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


  1   2   3   >