Re: Screen saver settings don't take effect (again) under Sonoma

2024-02-01 Thread Gabriel Zachmann via Cocoa-dev
: 
> displayname];
>
> Then, I read the actual values from monitor_user_prefs.
>
> When the user changes a setting, I do the inverse, like this:
>
>   .. create a new dictionary monitor_user_prefs, containing all the key/value 
> pairs of the settings ..
>   [defaults_ setObject: monitor_user_prefs forKey: displayName_];
>   bool success = [defaults_ synchronize];
>
>
> -- next part --
> A non-text attachment was scrubbed...
> Name: smime.p7s
> Type: application/pkcs7-signature
> Size: 5821 bytes
> Desc: not available
> URL: 
> <https://lists.apple.com/archives/cocoa-dev/attachments/20231012/e3a91277/attachment.bin>
>
> --
>
> Message: 2
> Date: Thu, 12 Oct 2023 08:22:21 -0500
> From: Steve Mills 
> To: Cocoa dev 
> Subject: Re: Screen saver settings don't take effect (again) under
> Sonoma
> Message-ID: <0d02e197-d36a-4a4b-ac48-297848fe9...@mac.com>
> Content-Type: text/plain; charset=us-ascii
>
>> On Oct 12, 2023, at 04:54, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> Now, under Sonoma (14.0), I have an issue with the settings (user defaults) 
>> of my screen saver, again.
>>
>> I go into System Settings, change some settings of my screen saver, they 
>> take effect immediately in the little Preview window in SysSettings, but 
>> when I click on "Preview" or let the screen saver come on automatically, the 
>> new settings are *not* in effect.
>>
>> From one user, I heard that the new settings take effect only after 
>> rebooting.
>>
>> So, maybe, something has changed in the way macOS 14.0 handles the 
>> NSUserDefaults, and/or maybe I make an error with using the API. Maybe there 
>> is a bug in macOS 14.0 ?
>>
>> Below you can find a recap of how I handle the settings using NSUserDefaults.
>> Interestingly, the same code works fine in a regular app (not screensaver).
>>
>> My screensaver stores different settings for different monitors in the 
>> [NSUserDefaults standardUserDefaults].
>> To do so, I generate
>> defaults_ = [NSUserDefaults standardUserDefaults];
>>
>> Then, I create a dictionary containing the default settings and register 
>> them, like this:
>>
>>  NSDictionary * monitor_defaults = [NSDictionary 
>> dictionaryWithObjectsAndKeys: defaultsForMonitor, displayname, nil ];
>>  [defaults_ registerDefaults: monitor_defaults];
>>  NSDictionary * monitor_user_prefs = [defaults_ dictionaryForKey: 
>> displayname];
>>
>> Then, I read the actual values from monitor_user_prefs.
>>
>> When the user changes a setting, I do the inverse, like this:
>>
>>  .. create a new dictionary monitor_user_prefs, containing all the key/value 
>> pairs of the settings ..
>>  [defaults_ setObject: monitor_user_prefs forKey: displayName_];
>>  bool success = [defaults_ synchronize];
>
> registerDefaults isn't doing what you think it's doing. Read its docs more 
> carefully.
>
> And there's no need to call synchronize. The docs clearly point that out: 
> "this method is unnecessary and shouldn't be used."
>
> To set a new default, simply use setObject:forKey:. To read them, simply use 
> objectForKey: or dictionaryForKey:, since you're using one.
>
> What you haven't shown is how you're coming up with a screen name. Are you 
> sure it's the same every time for each screen?
>
> Also, you *are* using the correct NSUserDefaults object, yes?
>
> NSUserDefaults* defaults = [ScreenSaverDefaults 
> defaultsForModuleWithName:@"com.yourcompany.yourscreensaver"];
>
> --
> Steve Mills
> Drummer, Mac geek
>
>
>
> --
>
> Message: 3
> Date: Thu, 12 Oct 2023 06:43:49 -0700
> From: Michael Diehr 
> To: Cocoa dev 
> Subject: Re: Screen saver settings don't take effect (again) under
> Sonoma
> Message-ID: <50200ccb-4313-4898-b9f1-c72b15257...@xochi.com>
> Content-Type: text/plain; charset=us-ascii
>
> There's an active discussion rying to reverse-engineer the screen saver 
> settings in Sonoma over on GitHub:
> https://github.com/JohnCoates/Aerial/issues/1332
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
>
> Cocoa-dev mailing list  (Cocoa-dev@lists.apple.com)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
> https://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
> --
>
> End of Cocoa-dev Digest, Vol 20, Issue 55
> *



smime.p7s
Description: S/MIME cryptographic signature
___

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 interferes with signal handler

2024-01-31 Thread Gabriel Zachmann via Cocoa-dev
Sorry, Jens and Pascal!
I have received your messages just now.
You were right, as I have found out a while later kind of the hard way ...

So, thanks again!


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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 interferes with signal handler (was: Sending SIGUSR1 to a process)

2024-01-31 Thread Gabriel Zachmann via Cocoa-dev
I think , I found the solution, so just for the record
(so that others will find it using Google):

Launch the app in the debugger on the command line :

   lldb /private/tmp/Build/Products/Debug/MyApp.app

In lldb's command line:

   process handle -p true -s false -n true   // otherwise lldb will stop on 
SIGUSR1

Set your breakpoints as needed, then

   r --no-stdin

Then you can 'kill -30 ' without getting those annoying breaks in 
mach_msg2_trap.


Hope this helps.
Gabriel.



smime.p7s
Description: S/MIME cryptographic signature
___

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 interferes with signal handler

2024-01-31 Thread Gabriel Zachmann via Cocoa-dev
I have investigated a bit further.

When I launch my app from lldb (on the command line),
it still stops in mach_msg2_trap when I send a SIGUSR1 to my app.

But at least, I get a more meaningful stack trace:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGUSR1
  * frame #0: 0x000188d91874 libsystem_kernel.dylib`mach_msg2_trap + 8
frame #1: 0x000188da3cf0 libsystem_kernel.dylib`mach_msg2_internal + 80
frame #2: 0x000188d9a4b0 libsystem_kernel.dylib`mach_msg_overwrite + 476
frame #3: 0x000188d91bf8 libsystem_kernel.dylib`mach_msg + 24
frame #4: 0x000188eafbf4 CoreFoundation`__CFRunLoopServiceMachPort + 160
frame #5: 0x000188eae4bc CoreFoundation`__CFRunLoopRun + 1208
frame #6: 0x000188ead9ac CoreFoundation`CFRunLoopRunSpecific + 608
frame #7: 0x00019345c448 HIToolbox`RunCurrentEventLoopInMode + 292
frame #8: 0x00019345c284 HIToolbox`ReceiveNextEventCommon + 648
frame #9: 0x00019345bfdc 
HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
frame #10: 0x00018c68a8a4 AppKit`_DPSNextEvent + 660
frame #11: 0x00018ce64980 AppKit`-[NSApplication(NSEventRouting) 
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
frame #12: 0x00018c67dd50 AppKit`-[NSApplication run] + 476
frame #13: 0x00018c655014 AppKit`NSApplicationMain + 880
frame #14: 0x000100021534 ArtSaverApp`main(argc=1, 
argv=0x00016fdfefd8) at main.m:10:12
frame #15: 0x000188a510e0 dyld`start + 2360


Does anybody have an idea why my signal handler would not get called when the 
app is running in the debugger?
But it does get called (as it should) when not running in the debugger?
How could a debugger possibly prevent my app from installing a signal handler ?

I'd like to debug my app after it caught the SIGUSR1 ...


Best regards, Gabriel


>
> I am setting up a signal handler in my app like this:
>
>   void *e = signal( SIGUSR1, signal_handler );
>   if ( e == SIG_ERR )
>  ...
>
> It works (i can 'kill -30 '), BUT ONLY, if I run my app outside of Xcode.
>
> When I launch it from Xcode, and I send a SIGUSR1 to my app, it always breaks 
> at mach_msg2_trap.
> Obviously, this is a bit tedious for developing, since now I always have to 
> go through Product / Archive / Distribute ...
>
> Any ideas, how I can prevent this from happening?
>
> And it's unclear to me what's going on. Can Xcode really prevent signal(3) 
> from installing a signal handler?
> Or does a kill on the command line deliver the signal to several processes, 
> one of them, maybe, an ancillary process from Xcode?
>



smime.p7s
Description: S/MIME cryptographic signature
___

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 interferes with signal handler (was: Sending SIGUSR1 to a process)

2024-01-30 Thread Gabriel Zachmann via Cocoa-dev
I am setting up a signal handler in my app like this:

   void *e = signal( SIGUSR1, signal_handler );
   if ( e == SIG_ERR )
  ...

It works (i can 'kill -30 '), BUT ONLY, if I run my app outside of Xcode.

When I launch it from Xcode, and I send a SIGUSR1 to my app, it always breaks 
at mach_msg2_trap.
Obviously, this is a bit tedious for developing, since now I always have to go 
through Product / Archive / Distribute ...

Any ideas, how I can prevent this from happening?

And it's unclear to me what's going on. Can Xcode really prevent signal(3) from 
installing a signal handler?
Or does a kill on the command line deliver the signal to several processes, one 
of them, maybe, an ancillary process from Xcode?


Best regards, Gabriel





smime.p7s
Description: S/MIME cryptographic signature
___

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: Sending SIGUSR1 to a process

2024-01-29 Thread Gabriel Zachmann via Cocoa-dev
>
> Yes, this should work. The only changes I know of is that you can’t signal 
> some Apple processes these days if System Integrity Protection is engaged.

I have tried it like the following, but to no avail:


void signal_handler( int sig )
{
logMessage( LogClient, [NSString stringWithFormat: @"signal %d caught", 
sig], NO );
}
// install signal handler

In the init method of my app I have:

void *e = signal( SIGUSR1, signal_handler );
if ( e == SIG_ERR )
{
char * errmesg = strerror( errno );
[self logMessage: [NSString stringWithFormat: @"Installing signal 
handler failed: %s", errmesg] asError: YES];
}



When I run my app (from Xcode), I don't get any error message, but sending a 
SIGUSR1 (using 'kill' on the command line) just makes it stop in mach_msg2_trap.
Stack trace:
  start, main, NSApplicationMain, mach_msg2_trap.
My signal_handler won't get called.






smime.p7s
Description: S/MIME cryptographic signature
___

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


Sending SIGUSR1 to a process

2024-01-28 Thread Gabriel Zachmann via Cocoa-dev
IIRC, one process cannot send a Unix signal to another one.
At least, not any more, and not without special privileges.

But would it be possible for a user to send a SIGUSR1 (using 'kill -30 ' 
on the command line) to a process they own?

I couldn't find information about that.
In fact, in the developer docs i couldn't find any info about Unix signals, 
what is possible or not under the new security regime in macOS.
(I can't remember where i read about the new limitations regarding signals 
under the new security regime.)

Any info will be highly appreciated.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Security-scoped bookmark and screensaver

2024-01-03 Thread Gabriel Zachmann via Cocoa-dev

>>
>> For that user, the directory for which my screensaver creates the bookmark 
>> is on an external HD.
>
> Is that use running 10.10? Googling reveals a bug resolving SSBs on external 
> drives that was fixed in 10.11.6.

He is running 10.14

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Security-scoped bookmark and screensaver

2024-01-03 Thread Gabriel Zachmann via Cocoa-dev
From one of the users of my screensaver, I get the issue report that resolving 
the SSB does not work.
He is running macOS 10.14.6 on a Mac Mini.
I have compiled my screensaver using the current version of Xcode, under macOS 
14, but for the target macOS 10.13.

When my screensaver tries to resolve the bookmark, I get the infamous
  Code%9 "The File couldn't be opened because it isn't in the correct format."

This happens, when my screensaver is launched by the ScreenSaverEngine.
When my screensaver is running in System Preferences, in the thumbnail window, 
everything is fine, and resolving the bookmark works, of course.
Also, there are other users of my screensaver (including me), where it runs 
just fine.

For that user, the directory for which my screensaver creates the bookmark is 
on an external HD.

Below is the source code showing how I create/resolve bookmarks.

Any ideas what I could try (or the user) will be highly appreciated.

Best regards, Gabriel


Create bookmark:

NSData * dir_bookmark = [dir bookmarkDataWithOptions: 
NSURLBookmarkCreationWithSecurityScope
   includingResourceValuesForKeys: nil
relativeToURL: nil
error: ];

[no problems occur here]


Resolve bookmark:

NSURL * dir_location = [NSURL URLByResolvingBookmarkData: bookmark
   options: 
NSURLBookmarkResolutionWithSecurityScope
 relativeToURL: nil
   bookmarkDataIsStale: & isStale
 error: & error];

[at this point, dir_location == nil, and I get the error code 259.
I can still extract the path using this code:

NSDictionary * dict = [NSURL resourceValuesForKeys: [NSArray 
arrayWithObjects: NSURLPathKey, nil]
  fromBookmarkData: bookmark ];
.. = [NSString stringWithFormat: @"Orig path: %@", [dict 
objectForKey: NSURLPathKey];




smime.p7s
Description: S/MIME cryptographic signature
___

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


Screen saver settings don't take effect (again) under Sonoma

2023-10-12 Thread Gabriel Zachmann via Cocoa-dev
IIRC, I had an issue with screen saver settings not taking effect some months 
ago (under Ventura), but back then it turned out to be a non-issue.

Now, under Sonoma (14.0), I have an issue with the settings (user defaults) of 
my screen saver, again.

I go into System Settings, change some settings of my screen saver, they take 
effect immediately in the little Preview window in SysSettings, but when I 
click on "Preview" or let the screen saver come on automatically, the new 
settings are *not* in effect.

From one user, I heard that the new settings take effect only after rebooting.

So, maybe, something has changed in the way macOS 14.0 handles the 
NSUserDefaults, and/or maybe I make an error with using the API. Maybe there is 
a bug in macOS 14.0 ?

Below you can find a recap of how I handle the settings using NSUserDefaults.
Interestingly, the same code works fine in a regular app (not screensaver).

I will be very grateful for any kind of suggestions or insights.

Best regards, Gabriel



My screensaver stores different settings for different monitors in the 
[NSUserDefaults standardUserDefaults].
To do so, I generate
  defaults_ = [NSUserDefaults standardUserDefaults];

Then, I create a dictionary containing the default settings and register them, 
like this:

   NSDictionary * monitor_defaults = [NSDictionary 
dictionaryWithObjectsAndKeys: defaultsForMonitor, displayname, nil ];
   [defaults_ registerDefaults: monitor_defaults];
   NSDictionary * monitor_user_prefs = [defaults_ dictionaryForKey: 
displayname];

Then, I read the actual values from monitor_user_prefs.

When the user changes a setting, I do the inverse, like this:

   .. create a new dictionary monitor_user_prefs, containing all the key/value 
pairs of the settings ..
   [defaults_ setObject: monitor_user_prefs forKey: displayName_];
   bool success = [defaults_ synchronize];




smime.p7s
Description: S/MIME cryptographic signature
___

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 check for full-screen apps, robustly?

2023-09-12 Thread Gabriel Zachmann via Cocoa-dev
Thanks a million!
(and sorry for the late response)

For the record (i.e., Google's databases), in case somebody else googles for 
this:
this seems to recognize full-screen windows even on Mac's with a notch:

   if ( win_rect.size.width >= mainScreen.visibleFrame.size.width &&
win_rect.size.height >= mainScreen.visibleFrame.size.height  )


Best regards, Gabriel



> On 19. Aug 2023, at 20:02, Angela Brett  wrote:
>
>>
>>
>> Now, this does not work any more on Mac's with "the notch".
>> At least, the Quicktime full-screen window, and a youtube video playing in 
>> Safari in full-screen,  is smaller than the mainScreen.frame.size .
>
> Have you tried using mainScreen.visibleFrame, or adjusting mainScreen.frame 
> with mainScreen.safeAreaInsets? I haven’t tried it but I would hope those 
> would give the right ‘fullscreen’ sizes for any current or future screen 
> shape.
>
>
> Angela Brett (she/her)
> http://angelastic.com
> ang...@angelastic.com
>
>
>
>
>



smime.p7s
Description: S/MIME cryptographic signature
___

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: 'originals' folder is greyed out

2023-09-05 Thread Gabriel Zachmann via Cocoa-dev
> Are you overriding NSOpenSavePanelDelegate -panel:shouldEnableURL:?  If so, 
> make sure your code isn’t

No, I am not doing anything with any of those methods .

> inadvertently disabling the folder for some reason.
>
> Doing those steps in TextEdit works fine for me.  Maybe ask the user to try 
> the same steps with TextEdit

good idea. will do.

> Open dialog and see if the behavior is different?
>
> If it was a permissions issue the icon would have a  badge on it and should 
> not appear disabled

Good to know.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


'originals' folder is greyed out

2023-09-05 Thread Gabriel Zachmann via Cocoa-dev
My app loads a number of image files and displays them.
To some users, I suggest the following in order for them to loads their photos:

> in Finder, go to your Pictures folder;
> control-click on the icon
>   Photos Library.photoslibrary,
> then select "Show Package Contents".
> Now go to the app's settings.
> First, select "Follow aliases", second
> click "Change" (folder to search);
> a folder dialog appears. Now, from the Photos library package contents folder,
> drag the folder 'originals' into the app's folder dialog.
> Then click Open, then OK.

Now, one user reported that, in his case, the folder 'originals' is greyed out.
(Dunno if it's greyed out in Finder, or in the app's folder open dialog.)

Anyways, I am wondering, does anybody have an idea why that is?

Best regards, Gabriel

PS:
Yes, I know that an app/user should never mess with the contents of the photos 
library.
But in my app, I am merely loading the files, nothing else.




smime.p7s
Description: S/MIME cryptographic signature
___

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 check for full-screen apps, robustly?

2023-08-19 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for the quick response.

I was thinking of the styleMask, too, but IIUC, the documentation
of CGWindowListCopyWindowInfo says that I get only 
Required Window List Keys and Optional Window List Keys,
and the styleMask is not part of those.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


How to check for full-screen apps, robustly?

2023-08-19 Thread Gabriel Zachmann via Cocoa-dev
How can I robustly check in my app whether or not there is any other window 
running in full-screen?

I would like to prevent my app from going full-screen if another app is 
currently running in full-screen.
(For instance, when the user is watching a video in Quicktime Player or Safari 
in full-screen, or is having a video call, then they probably don't want my app 
to interfere.)


So far, I did that with the following lines of code (omitting some minor 
details):

guard let winArray = CGWindowListCopyWindowInfo(options, kCGNullWindowID) as? 
[[ String : Any]]
else { .. }
for winInfo in winArray
{
guard let boundsDict = winInfo[kCGWindowBounds as String] as! CFDictionary?
else { .. }
guard let win_rect = CGRect.init( dictionaryRepresentation: boundsDict )
if ( __CGSizeEqualToSize( win_rect.size, mainScreen.frame.size) )
  .. found full-screen window ..
}


Now, this does not work any more on Mac's with "the notch".
At least, the Quicktime full-screen window, and a youtube video playing in 
Safari in full-screen,  is smaller than the mainScreen.frame.size .

I guess I could detect whether or not it's a Mac with the notch, and use a 
smaller mainScreen.frame.size accordingly;
but I am pretty sure this would break with the next Mac models again.


So, I am looking for something more future-proof.


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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 with app settings / NSUserDefaults

2023-08-15 Thread Gabriel Zachmann via Cocoa-dev
Right, that makes sense, in particular with Saga's insights in mind.

> Use the commend “defaults delete de.zach.ArtSaverApp” to delete all your 
> prefs.  That should remove them everywhere.
>





smime.p7s
Description: S/MIME cryptographic signature
___

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 with app settings / NSUserDefaults

2023-08-15 Thread Gabriel Zachmann via Cocoa-dev
Ah, thanks a lot for the insights!

Could it happen that the new settings have not been written to disk even if the 
app has quit normally?
Or, in other words, there might be key/value pairs stored in cfprefsd's 
internal/runtime storage, even if i have changed the app and those key/value 
pairs do no loner correspond to any of the app's settings?

Best regards, Gabriel



> On 6. Aug 2023, at 12:57, Saagar Jha  wrote:
>
> The plist file on disk is written to sporadically. cfprefsd is generally the 
> arbiter what the real values are, and it may or may not write things to disk 
> immediately. Conversely, it’s not necessarily sitting around watching the 
> plist file for changes. The correct way to update user defaults in an ad-hoc 
> fashion is to use the defaults command.
>



smime.p7s
Description: S/MIME cryptographic signature
___

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: Full-screen not working

2023-08-15 Thread Gabriel Zachmann via Cocoa-dev
I can try that , but I would have no idea what to look for.

Is there any known reasons why a toggleFullScreen call might not send the 
window to full-screen?





smime.p7s
Description: S/MIME cryptographic signature
___

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: Full-screen not working

2023-08-15 Thread Gabriel Zachmann via Cocoa-dev
> I have tested this on 1, 2 and 3 display systems over a month ago.  There 
> appears to be a 1/2 hour delay (or so) before it takes over and is full 
> screen.

Very strange - how could that be?

> Greetings from the deepest darkest jungles of suburban Windhoek.

Happy safari!

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Full-screen not working

2023-08-15 Thread Gabriel Zachmann via Cocoa-dev
I have one user of my macOS app (under macOS 13.4.1)
where the app does not want to go into full-screen mode.

It is a pretty plain app.

In the AppDelegate's method -applicationWillFinishLaunching,
I switch to full screen like this:

   [self.window toggleFullScreen: nil];

It works, of course, all the time on my Mac;
also, as far as I know, there is only one user where it does not work.

After toggleFullScreen, I could check if the window is in full-screen, but I 
don't see I would gain anything from that.
The toggleFullScreen does not seem to provide any error value.

I have already googled, but it seems like what that user reports does not 
happen anywhere else.

Is there anything that could prevent a window from going into fullscreen mode?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Screensaver options: nothing clickable

2023-08-13 Thread Gabriel Zachmann via Cocoa-dev
One of the users of my screensaver has reported a very funny bug:
my screensaver is working, but when they open the Options panel, they cannot 
click on any GUI element; well, they can click, but nothing happens, as if that 
does not generate any event.
Consequently, when they click on the "OK" button in the Options panel, nothing 
happens, too, so they have to force quit the legacyScreenSaver.

This happens under macOS 13.
I have built my screensaver as a universal .saver bundle.

Any ideas what I could try to make the Options GUI elements clickable again?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Confusion with app settings / NSUserDefaults

2023-08-06 Thread Gabriel Zachmann via Cocoa-dev
I am pretty confused with the NSUserDefaults system.

My app stores different settings for different monitors in the [NSUserDefaults 
standardUserDefaults].
To do so, I generate
   defaults_ = [NSUserDefaults standardUserDefaults];

Then, I create a dictionary containing the default settings and register them, 
like this:

NSDictionary * monitor_defaults = [NSDictionary 
dictionaryWithObjectsAndKeys: defaultsForMonitor, displayname, nil ];
[defaults_ registerDefaults: monitor_defaults];
NSDictionary * monitor_user_prefs = [defaults_ dictionaryForKey: 
displayname];

Then, I read the actual values from monitor_user_prefs.

When the user changes a setting, I do the inverse, like this:

.. create a new dictionary monitor_user_prefs, containing all the key/value 
pairs of the settings ..
[defaults_ setObject: monitor_user_prefs forKey: displayName_];
bool success = [defaults_ synchronize];

Now, the focusing part is the following.
I delete the Preferences folder in the app's container.
I can check with the the 'defaults' command line tool that it's really gone:

  % defaults read de.zach.ArtSaverApp
  Domain de.zach.ArtSaverApp does not exist

I run the app, and its settings are properly populated with the defaults I set 
programmatically in the app.
E.g., DurationPerImage is 60 (sec).

*However*, when I open the plist file in Xcode, I see four key/dictionary pairs!
The keys are the names of some of the monitors I have used in the past, so they 
are not entirely bogus.
But right now, my laptop is not connected to any external monitor, just the 
internals LCD display.
So there should be really only one dictionary, with the name "Built-in Retina 
Display".

Next thing that's also very confusing is the following.
I close the app. Then I change a value in the plist using XCode.
Then I save the plist (CMD-S) in Xcode.
Then I run my app again - but the setting has not changed!

It seems as if macOS is keeping the settings somewhere else, instead of the 
plist file.
OTOH, when I change a setting in the app, the value in plist file reflects 
that, even while I have the plist file open in Xcode.

Very confused,
Gabriel.



smime.p7s
Description: S/MIME cryptographic signature
___

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: Substitute for kill(2)? (James Walker)

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
>>
> An XPC service isn't an app, and wouldn't you need an app to run an
> NSStatusItem, which I assume is what's meant by a "menu bar item"?

Oh, sorry, PS:
yes, I do create

let statusBar = NSStatusBar.system
statusBarItem_ = statusBar.statusItem( withLength: 
NSStatusItem.variableLength )

in my app ...




smime.p7s
Description: S/MIME cryptographic signature
___

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: Substitute for kill(2)? (James Walker)

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev

>>
> An XPC service isn't an app, and wouldn't you need an app to run an
> NSStatusItem, which I assume is what's meant by a "menu bar item"?
>

I am just a beginner in "menu bar items" , but what I have is an

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate

which Xcode compiles into an app, which, when launched, just sits in the menu 
bar.


> See  for a discussion
> of XPC versus some other methods of communication.
>

Thanks for the link!

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
> NSDistributedNotificationCenter is a way to send a notification out across 
> the system. Only processes that are listening for the notification will 
> receive it and have a chance to do something with it. It’s like yelling out 
> in a crowded room to tell a single person something. Everyone will hear your 
> message, but only one will be listening. Make sense?

Definitely. Sounds great for my purpose.
It will happen only very rarely.
And I don't have any payload.

>  
> https://developer.apple.com/documentation/foundation/nsdistributednotificationcenter?changes=_4=objc
>

Thanks a lot for the pointer!

> But what it really sounds like you want to use XPC (Cross Process 
> Communication) for a more targeted

I had looked into that but it appeared to heavy-weight for my purposes.


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your responses!

Sorry for the misunderstanding: I don't want to kill the other process.
(In case you forgot: the kill(2) system call is for sending unix signals to 
processes, which can listen to those signals (at least, most of them). I just 
want to signal the other process, not really kill it. So, SIGUSR1 would've been 
my choice, if macOS would allow me to send a signal.)

What do you mean by "distributed notification" ?
How would I send it?

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
Is there a simple way for one process to send a single signal to another 
process?
Both processes are my programs, one is a regular app, the other a menu bar item.
Both are launched by the same user.

In the old unix days, I would have used kill(2) and send a SIGUSR1 , but as far 
as I understand, this is no longer possible.
(At least,  not without privilege elevation, which seems too complicated.)

All hints and ideas will be appreciated!
Best regards, Gabriel





smime.p7s
Description: S/MIME cryptographic signature
___

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: "Z" in setDateFormat ?

2023-07-22 Thread Gabriel Zachmann via Cocoa-dev
Thanks! ... and what is the meaning of the Z at the end of a date/time ?
GMT+0:0 ?

Best regards, Gabriel


> On 22. Jul 2023, at 12:25, Roland King  wrote:
>
> It’s a literal. It’s quoted. So it prints “Z”
>
>> On 22 Jul 2023, at 06:15, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> In the Apple docs in chapter "Date Formatters" I found sample code that 
>> contains this line:
>>
>> [rfc3339DateFormatter setDateFormat:@"'-'MM'-'dd'T'HH':'mm':'ss'Z'"];
>>
>> Now, my very specific question is: what does the 'Z' do?
>> And where would I find the doc about it? (and potential other letters?)
>> My guess would be it has something to do with the 'Z'/time offset mentioned 
>> in RFC 3339, but it is unclear to me exactly what is meant here.
>>
>> Best regards, Gabriel
>>
>> ___
>>
>> 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/rols%40rols.org
>>
>> This email sent to r...@rols.org



smime.p7s
Description: S/MIME cryptographic signature
___

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


"Z" in setDateFormat ?

2023-07-22 Thread Gabriel Zachmann via Cocoa-dev
In the Apple docs in chapter "Date Formatters" I found sample code that 
contains this line:

  [rfc3339DateFormatter setDateFormat:@"'-'MM'-'dd'T'HH':'mm':'ss'Z'"];

Now, my very specific question is: what does the 'Z' do?
And where would I find the doc about it? (and potential other letters?)
My guess would be it has something to do with the 'Z'/time offset mentioned in 
RFC 3339, but it is unclear to me exactly what is meant here.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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 do decipher an exception in the log file

2023-07-21 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for the hint.

Alas, the user has reported that Console does not show any crash report w.r.t. 
my screensaver.

My guess would be that this is because a .saver bundle, when launched by the 
screen saver engine, does not count as a process of its own. Or, at least, the 
OS will not store a crash log, if the thread crashes.

Should the user be looking somewhere else?


Best regards, Gabriel


> On 20. Jul 2023, at 10:12, Saagar Jha  wrote:
>
> Console should have it. That crash log will have the base address in it that 
> you can use to symbolicate things.
>
> Saagar Jha
>
>> On Jul 18, 2023, at 16:01, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>>
>>> That number is 0x7FFF, which is particularly recognizable and 
>>> happens to be the value of NSNotFound.
>>>
>>> I imagine that in the preceding line of code you called -indexOfObject: on 
>>> an array that didn't contain the object, but then failed to test the value 
>>> against NSNotFound before trying to fetch from that index.
>>>
>>
>> Thanks a million!
>> Very interesting observation.
>> The fact that
>>  9223372036854775807 = 0x7FFF
>> escaped me.
>> And, indeed, I do have a few indexOfObject's in my code, and luckily not 
>> that many.
>>



smime.p7s
Description: S/MIME cryptographic signature
___

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 do decipher an exception in the log file

2023-07-18 Thread Gabriel Zachmann via Cocoa-dev

> That number is 0x7FFF, which is particularly recognizable and 
> happens to be the value of NSNotFound.
>
> I imagine that in the preceding line of code you called -indexOfObject: on an 
> array that didn't contain the object, but then failed to test the value 
> against NSNotFound before trying to fetch from that index.
>

Thanks a million!
Very interesting observation.
The fact that
  9223372036854775807 = 0x7FFF
escaped me.
And, indeed, I do have a few indexOfObject's in my code, and luckily not that 
many.


>> More precisely, is there a way I can determine the location in the code 
>> where the exception occurred?
>
> Do you have symbols for the particular build of the app that crashed? If so, 
> there ought to be some way to symbolicate the list of addresses in the "Stack 
> trace:" line of the log messages... although maybe not, without knowing the 
> base load address of the executable.

Problem is that its a screensaver (i.e., a .saver file).
I guess the base adress is always different, at least I have no idea what the 
base address might be.

> A full-on crash report, rather than log messages, would be a lot more useful.

Where would i find that crash report, given its a screensaver?
Just in case something like that happens again ...


Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


How do decipher an exception in the log file

2023-07-18 Thread Gabriel Zachmann via Cocoa-dev
Does anybody know how I could decipher the following entries in the log file?
More precisely, is there a way I can determine the location in the code where 
the exception occurred?

Thanks a lot in advance.

G.

2023-07-17 13:13:23.650173+0200 0xff744Default 0x1144e1 
2670   0legacyScreenSaver: (ScreenSaver) [com.apple.ScreenSaver:Modules] 
-[ScreenSaverView setScreenSaverModule:] -- Setting module “ArtSaver” for view: 
0x7fe349028000
2023-07-17 13:13:23.650194+0200 0xff744Default 0x1144e1 
2670   0legacyScreenSaver: [com.apple.ScreenSaver:Modules] 
-[LegacyViewController setLegacyModuleView:] -- inView Size: {114, 66}
2023-07-17 13:13:23.656894+0200 0xff744Default 0x1144e1 
2670   0legacyScreenSaver: (ExceptionHandling) NSExceptionHandler has 
recorded the following exception:
NSRangeException -- *** -[__NSArrayM objectAtIndexedSubscript:]: index 
9223372036854775807 beyond bounds [0 .. 0]
Stack trace:  0x7ff80775142b  0x7ff807d053ca  0x7ff807ba19a1  0x1006871a5  
0x7ff80ac5c3e6  0x7ff80ac65c6c  0x10001a411  0x10001bcc6  0x7ff807ba8377  
0x7ff807ba820e  0x10001b990  0x7ff807937033  0x7ff807944c60  0x7ff807937033  
0x7ff807943fcf  0x7ff807943c07  0x7ff807bf3205  0x7ff807bb2f2f  0x7ff807bb1f31  
0x7ff81162ddad  0x7ff81162dbbe  0x7ff81162d918  0x7ff80ac465d0  0x7ff80ac4547a  
0x7ff80f981486  0x7ff80f981221  0x7ff80f981408  0x7ff80f96ea61  0x7ff80ac37ae8  
0x7ff80ac0bd02  0x7ff80782a851  0x7ff80782a1f7  0x7ff808a5f58d  0x7ff81549f43b  
0x7ff81549f03f  0x7ff81549f80a  0x7ffa26eee05f  0x7ff808ac2e54  0x7ff80777e41f
2023-07-17 13:13:23.657093+0200 0xff744Error   0x1144e1 
2670   0legacyScreenSaver: [com.apple.ScreenSaver:Modules] 
-[LegacyExtensionManager exceptionHandler:shouldHandleException:mask:] -- 
Module: ArtSaver threw an uncaught exception: NSRangeException, reason: *** 
-[__NSArrayM objectAtIndexedSubscript:]: index 9223372036854775807 beyond 
bounds [0 .. 0].
2023-07-17 13:13:23.657278+0200 0xff744Error   0x1144e1 
2670   0legacyScreenSaver: [com.apple.ScreenSaver:Modules] 
-[LegacyExtensionManager processExtensionRequest:replyInfo:]_block_invoke -- 
Module: ArtSaver (ArtSaver) failed to load. Exception: NSRangeException, 
reason: *** -[__NSArrayM objectAtIndexedSubscript:]: index 9223372036854775807 
beyond bounds [0 .. 0]




smime.p7s
Description: S/MIME cryptographic signature
___

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


Log file not showing all messages

2023-07-14 Thread Gabriel Zachmann via Cocoa-dev
I have an app that logs messages (info and errors) as follows:

...
log_client_ = os_log_create( "de.zach.MyApp", "MyApp" );
...

void logMessage( NSString* msg, bool is_error )
{
if ( [ msg canBeConvertedToEncoding: NSUTF8StringEncoding] )
msg_string = [msg UTF8String];
else
msg_string = [[msg dataUsingEncoding: NSASCIIStringEncoding 
allowLossyConversion: YES] bytes];
if ( is_error )
os_log_error( log_client_, "%{public}s", msg_string );
else
os_log_info( log_client_, "%{public}s", msg_string );
}


Occasionally, users send me their log files, but they contain only a small 
subset of all the message my app outputs!

I am interested in messages like this:

2023-07-12 15:12:47.177849-0400 0x3bffc0   Info0x5e4dc3 
21784  0MyApp: [de.zach.MyApp:MyApp] writing preferences (display name = 
HDMI)

The message "writing preferences .." is an example message I output in my app.

I get a lot of other messages that I don't output; I guess they are output by 
some framework I'm using, such as:

2023-07-12 15:12:23.437424-0400 0x3bffc0   Info0x0  
21784  0MyApp: (HIToolbox) [com.apple.HIToolbox:MBDisplays] 

That's fine with me, except that a lot of the messages that I do output are 
missing!

Users extract the log message using this command in Terminal:

% log show --predicate 'process == "MyApp"' --info --debug > ~/Desktop/Log.txt

Naturally, this command works fine on my machine, and I get all the messages I 
am expecting.

This is all happening under macOS 13 (Ventura).


Big question: why is it that the log files from users sometimes do not contain 
all the messages my app outputs??
They all occur on the same day, and users extract and send their log files on 
the same day the problem occurs.


Any ideas and hints will be highly appreciated!

Best, G.



smime.p7s
Description: S/MIME cryptographic signature
___

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 running only on one display with a multiple display setup

2023-06-13 Thread Gabriel Zachmann via Cocoa-dev

> By logging when init and viewDidMoveToWindow methods, you can see when the 
> latter fails to be called.

That's what i did

> It's a bug Apple needs to fix.

Oh, it's a well-known bug?
Good to know.

> They broke it some time ago, then didn't fix it when the partially fixed 
> legacy screensavers in 13.4. Just continue to report their bugs.

Will do.

>
> I?m seeing it failing on MacOS 10.5.5 on a 3 monitor system and in 13.2.1 on 
> a 2 monitor system when compiled from source.  And by ?fail?, I mean that it 
> only runs on one display.

Thanks a lot!
Would be interesting to see how it performs on 13.4 ...


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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 running only on one display with a multiple display setup

2023-06-10 Thread Gabriel Zachmann via Cocoa-dev

>
> I have one user, who has three displays connected to the Mac, but only the 
> main display (center) gets a screensaver.
> This is on macOS Ventura 13.4.
> (I should also say that with other users, who also have multiple displays, 
> everything seems fine.)
>
> According to the log file, legacyScreenSaver does launch three instances of 
> my screen saver, but then only one continues to run.

Two of the instances never reach method -viewDidMoveToWindow.

Is there a way to instrument the source code or the executable, such that I can 
receive a line-by-line trace of the execution of the three screensaver 
instances from that user?

I am wondering if two of the instances are crashing.
But I don't know how to retrieve more info about it (if any).

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: NSScreen.screens under multiple displays

2023-06-10 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot.

But different displays/monitors will count as different screens,
no matter if "Displays have separate Spaces" is on or off?

Best regards, Gabriel


> On 8. Jun 2023, at 19:45, Rob Petrovec  wrote:
>
> The order of the screens can change under various user scenarios.  One easy 
> one is simply re-arranging the displays, or even moving the menu bar thing 
> from one display to another in the Arrange UI Displays prefs pane. Obviously 
> plugging & unplugging displays or closing a laptop with an external display 
> will change it too. You should not assume the index of the screen your window 
> is on, if that is what you were thinking.  Hope that helps.
>
> —Rob



smime.p7s
Description: S/MIME cryptographic signature
___

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


NSScreen.screens under multiple displays

2023-06-08 Thread Gabriel Zachmann via Cocoa-dev
In my method

   - (void) viewDidMoveToWindow

I have these lines of code:

window_ = [self window];
NSUInteger idx_of_screen = [NSScreen.screens indexOfObject: window_.screen];

My question is: will this always produce the same results, whether or not the 
user has switched "Displays have separate Spaces" on or off (under Desktop & 
Dock).


Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Screensaver running only on one display with a multiple display setup

2023-06-08 Thread Gabriel Zachmann via Cocoa-dev
I have a screensaver that is supposed to run on all displays simultaneously.
MacOS launches several instances, if there are multiple displays.

I have one user, who has three displays connected to the Mac, but only the main 
display (center) gets a screensaver.
This is on macOS Ventura 13.4.
(I should also say that with other users, who also have multiple displays, 
everything seems fine.)

According to the log file, legacyScreenSaver does launch three instances of my 
screen saver, but then only one continues to run.
There are no error message or other hints - as far as I can see - as to why the 
other two instance do not continue to run; I believe they are killed.

Does anyone have an idea? Or an idea how I could track down the problem?

I know all three instances are launched because I can see their individual info 
messages in the log file.
But then, only one of them continues to output info message in the log file.

Thanks a lot in advance.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


IOSurface creation failed

2023-05-16 Thread Gabriel Zachmann via Cocoa-dev
My slide show app loads a large number of images and displays them using 
CALayer.
Occasionally, I get an error message in the log like this:

2023-05-16 16:16:33.606195+0700 MyApp[17514:6600184] IOSurface creation failed: 
e2c2 parentID:  properties: {
IOSurfaceAddress = 5712560128;
IOSurfaceAllocSize = 52879491;
IOSurfaceCacheMode = 0;
IOSurfaceName = CMPhoto;
IOSurfacePixelFormat = 1246774599;
}

It does not seem to come from my app directly.
I suspect it is caused by CALayer, or could it be caused by 
CGImageSourceCreateThumbnailAtIndex())?

Anyways, I am wondering what it means, and I am wondering if I should do 
anything about it?

It occurs only for some images, and I haven't found a pattern yet.
Also, it seems to have no effect on my app.

I have googled, of course, but could not find anything helpful.
(The dev docs were also not really helpful in this case.)

Best regards, Gabriel

Macbook Air M2, MacOS 13.3.1



smime.p7s
Description: S/MIME cryptographic signature
___

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: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Hm, on closer inspection, maybe it did help.
At the moment, at least, the memory footprint of my app levels out at 3GB 
(which would be OK).

In any case, thanks again so much to everybody who chimed in!

Best regards, Gabriel


> On 1. May 2023, at 12:43, Gabriel Zachmann  wrote:
>
> Thanks a lot for the hint!
> I tried it, but it did not change anything in the behavior of the app.
>
> Best regards, Gabriel
>
>
>> On 1. May 2023, at 09:54, Sandy McGuffog  wrote:
>>
>> Yet another possible issue is that Apple’s frameworks tend to like to hold 
>> onto and reuse objects like CALayers. As a result they also hold onto the 
>> contents for much longer than you might think. I would at least try 
>> imgLayer.contents = nil as soon as you’re sure the layer won’t be displayed 
>> again.
>>



smime.p7s
Description: S/MIME cryptographic signature
___

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: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Thanks so much again!

I tried, and it didn't give me a good clue, though.
What I got as output is:
All zones: 1466 nodes malloced - Sizes: 117040KB[25] 96KB[25] 8KB[2] 5.5KB[1] 
5KB[1] 4KB[2] 3KB[3] 2.5KB[2] 2KB[4] 1.5KB[4] 656[15] 592[2] 528[2] 512[2] 
448[5] 400[3] 384[2] 368[3] 352[1] 336[1] 304[35] 288[19] 272[16] 256[29] 
240[8] 224[6] 208[40] 192[9] 176[15] 160[7] 144[5] 128[7] 112[30] 96[7] 80[32] 
64[115] 48[298] 32[553] 16[130]

So that does not account for the 5+GB (after a few minutes, and growing), I 
think.

Best regards, Gabriel




> On 30. Apr 2023, at 20:41, Rob Petrovec  wrote:
>
> Oh yeah, Gabriel, another technique you can use is to start your app and 
> create a memgraph _before_ reproducing the problem.  Then reproduce the 
> problem and run ‘heap MyApp --diffFrom MyApp.memgraph’.  It will show the new 
> objects that have been created since the memgraph was taken, sorted number of 
> objects. That might narrow down what object(s) are eating your memory.  Good 
> luck.
>
> —Rob
>



smime.p7s
Description: S/MIME cryptographic signature
___

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: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
___

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: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response!

I am not sure, though, I understand what you mean.

I've got 3 autoreleasepool's in different places in my source code. They are 
just
   @autoreleasepool { ... do something ... }

What do you mean by "insufficient use" ? and how do you mean "exit the nearest 
autorelease pool block"? is there a problem if I do a 'return' inside an
  @autoreleasepool {  }
?
(And why should it be a problem whith just one out of 100k+ files? :-) )

Best regards, Gabriel


> On 1. May 2023, at 03:46, Christopher Snowhill  wrote:
>
> Another possibility is insufficient use of autorelease pools. Even if you are 
> freeing your Objective C objects, if you do not exit the nearest autorelease 
> pool block, they will simply accumulate in the heap. Leak tools will not 
> consider these to be "leaked" memory.
>



smime.p7s
Description: S/MIME cryptographic signature
___

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: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response!
And thanks a lot for your hints to 'leaks'.

I tried it, but I don't see any "ROOT CYCLE" in the output of 'leaks'.
(I see a bunch of ROOT LEAKS, but in total it's just 6 kB.)

Also, in the Debugger of Xcode, when i click on "Debug Memory Graph" icon, I 
get lots of graphs, but none of them shows a cycle.
Same when I double-click the memgraph file: I can select all the memory graphs 
that go through CGImage, but none of them contains a cycle (and most of them 
don't originate in my code).

And, yes, I do release the images using CFRelease() - but, of course, still 
thanks for the thought!

( I also switched on MallocStackLogging, but that did not provide more info on 
potential causes for the massive leak, of course.)


Still stymied, Gab.




smime.p7s
Description: S/MIME cryptographic signature
___

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


Memory leak in Apple's image handling frameworks ?

2023-04-29 Thread Gabriel Zachmann via Cocoa-dev
I have an app that is basically a slide show.
Basically, it loads one image after another, displays it, then frees up its 
memory.
When I test it with my image collection of 100k+ images, everything is fine.

However, one user sent me a photo (JPG) that makes my app use up more and more 
memory.
I can see it in Activity Monitor and in Xcode's Memory Report View.
After a minute, my app uses 5 GB of main memory, after that, the growth rate 
slows down a bit,
but it keeps growing without bounds, until, eventually, it crashes, of course.

However, when I try to check for memory leaks using XCode/Instruments/Leaks, it 
says there are none!

Is it possible there is a memory leak in Apple's frameworks?

If you are interested, you can find the image here:
  https://owncloud.informatik.uni-bremen.de/index.php/s/BbBJcjMSTm9enwW
It's just 5 MB, and I can't see any issue with it.
The uncompressed image in-memory maybe takes up 100MB.

The frameworks/methods I use are the usual:
CGImageSourceCreateWithURL() for loading, CALayer for displaying.

I assign the image like this:

CALayer * imgLayer   = [CALayer layer];
imgLayer.contents= (__bridge id)(imageRef);

where imageRef is of type CGImageRef.
I also release my images later with CGImageRelease().

I am a stymied.
Any hints/suggestions will be highly appreciated.

Gab.





smime.p7s
Description: S/MIME cryptographic signature
___

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 under 13.3 using multiple monitors appears funny

2023-04-23 Thread Gabriel Zachmann via Cocoa-dev
>
> Yes, Apple broke legacy screensavers when multiple monitors are present, even 
> some of their own screensavers. We just have to wait for them to fix it. It's 
> been reported, and I've heard that they are aware.

That makes me suspect a bit that Apple is working on the legacyScreenSaver SW 
infrastructure.
Does anybody know anything definitive?
(I am worried that soon my screensaver will need some serious rewriting.)

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Screensaver under 13.3 using multiple monitors appears funny

2023-04-22 Thread Gabriel Zachmann via Cocoa-dev
With the latest upgrade to macOS 13.3,
I have received a few reports from users that my screensaver (a real .saver) 
looks funny when the Mac has two monitors, the built-in one and an external one.

Symptoms:
it does not show anything on the builtin monitor, as if it's not running on 
that one.
And on the external monitor it appears only in a very small rectangle, the rest 
is black, but it looks like it's running on the full screen, except only a 
rectangle is shown.

Did anyone notice something similar with other screensavers?
Does, by any chance, have anybody an idea what might be causing it?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2023-01-15 Thread Gabriel Zachmann via Cocoa-dev
> Is there any reason why you don't want to do it yourself, simply loading the 
> first KBs of the file ? I haven't been writing JPEG decoders for a lng 
> time, but I'm pretty sure the EXIF (APPn) marker must be written before the 
> image data (the SOS marker(s)), so it is at the beginning of the file.

I had thought of that , too.
The reason is that I have no experience whatsoever with the JPEG file format.
Nor with the EXIF file format.
Also, I need to be able to parse at least JPEG, PNG, TIF, GIF, and I'd like to 
add HEIC.

Best regards, Gabriel

> You could simply parse the first markers of the file (0xFF, 0x??) and look 
> for the EXIF one. The JPEG file format (JFIF) is pretty simple to decode (I 
> can help).
>
> Regards,
>
> Raphaël
>
>
> On Sun, Jan 8, 2023 at 3:30 PM Chris Ridd via Cocoa-dev 
>  wrote:
>
>
> > On 7 Jan 2023, at 23:31, Gabriel Zachmann via Cocoa-dev 
> >  wrote:
> >
> >>
> >> I wonder if there is a method to load the EXIF data out of the files 
> >> without opening them completely.  That would seem like the ideal approach.
> >
> > That's the approach I am looking for, but I haven't found any API to do 
> > that.
>
> I’m sure you’ve tried the following, but in case you haven’t:
>
> * investigate mmapping each file into memory and use a version of the API 
> that takes NSData/CFData instead of a file/URL to get the EXIF information.
>
> * if the files are indexed by Spotlight, can you get the EXIF information 
> from a NSMetadataQuery search?
>
> Chris
> ___
>
> 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/lemoine.raphael%40gmail.com
>
> This email sent to lemoine.raph...@gmail.com



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2023-01-07 Thread Gabriel Zachmann via Cocoa-dev
>
> I wonder if there is a method to load the EXIF data out of the files without 
> opening them completely.  That would seem like the ideal approach.

That's the approach I am looking for, but I haven't found any API to do that.

Best, G.



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2023-01-07 Thread Gabriel Zachmann via Cocoa-dev
*Maybe* ...
that would mean that the filesystem performs predictive caching like the CPU's 
cache / memory management does ...

Also, I think you might even get worse performance: imagine several threads 
reading different files *at the same time* - those files could lie on different 
HD cylinders far apart from each other, so the disk heads would have to move 
back and forth during those concurrent read operations, wouldn't it? unless the 
disk would do some very clever caching / batching / prediction itself ...

G.

> Since file systems and the associated hardware are designed to be efficient 
> by caching data and knowing things like where one file or block is in 
> relation to another, there’s a possibility these mechanisms could work to 
> your advantage, pulling in the data while “in the neighborhood.” There’s no 
> guarantee, of course, but I feel it’s worth considering.
> --
> Gary L. Wade
> http://www.garywade.com/
>
>> On Jan 7, 2023, at 10:37 AM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> So, why would would several threads loading those images in parallel help 
>> here? In my thinking, they will just compete for the same resource, i.e., 
>> hard disk.
>>
>



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2023-01-07 Thread Gabriel Zachmann via Cocoa-dev
Hi Alex, hi everyone,

thanks a lot for the many suggestions!
And sorry for following up on this so late!
I hope you are still willing to engage in this discussion.

Yes, Alex, I agree in that the main question is:
how can I get the metadata of a large amount of images (say, 100k-300k) 
*without* actually loading the whole image files.
(For your reference: I am interested in the date tags embedded in the EXIF 
dictionary, and those dates will be read just once per image, then cached in a 
dictionary containing filename & dates, and that dictionary will get stored on 
disk for future use by the app.)

> CGImageSourceRef imageSourceRef = 
> CGImageSourceCreateWithURL((CFURLRef)imageUrl, NULL);

I have tried this:

   for ( NSString* filename in imagefiles )
   {
  NSURL * imgurl = [NSURL fileURLWithPath: filename isDirectory: NO];
 CGImageSourceRef sourceref = CGImageSourceCreateWithURL( (__bridge 
CFURLRef) imgurl, NULL );
   }

This takes 1 minute for around 300k images stored on my internal SSD.
That would be OK.

However! .. if performed on a folder stored on an external hard disk, I get the 
following timings:

  - 20 min for 150k images (45 GB)
  - 12 min for 150k images (45 GB), second time
  - 150 sec for 25k images (18 GB)
  - 170 sec for 25k images (18 GB), with the lines below (*)
  - 80 sec for 22k (3 GB) images
  - 80 sec for 22k (3 GB) images, with the lines below (*)

All experiments were done on different folders on the same hard disk, WD 
MyPassport Ultra, 1 TB, USB-A connector to Macbook Air M2.
Timings with the same number of files/GB were the same folders, resp.

(*): these were timings where I added the following lines to the loop:

CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex( image, 
0, NULL );
bool success = CFDictionaryGetValueIfPresent( fileProps, 
kCGImagePropertyExifDictionary, (const void **) & exif_dict );
CFDictionaryGetValueIfPresent( exif_dict, 
kCGImagePropertyExifDateTimeDigitized, (const void **) & dateref );
iso_date = [isoDateFormatter_ dateFromString: (__bridge NSString * 
_Nonnull)(dateref) ];
[datesAndTimes_ addObject: iso_date ];

(Plus some error checking, which I omit here.)

First of all, we can see that the vast majority of time is spent on 
CGImageSourceCreateWithURL().
Second, there seem to be some caching effects, although I have a hard time 
understanding that, but that is not the point.
Third, the durations are not linear; I guess it might have something to do with 
the sizes of the files, too, but again, didn't investigate further.

So, it looks to me like CGImageSourceCreateWithURL() really loads the complete 
image file.

I don't see why Ole Begemann (ref'ed in Alex' post) can claim his approach does 
not load the whole image.


Some people suggested parallelizing the whole task, using dispatch_queue_create 
or NSOperationQueue.
(Thanks Steve, Gary, Jack!)
Before restructuring my code for that, I would like to better understand why 
you think that will speed up things.
The code above pretty much does no computations, so most of the time is, I 
guess, spent on waiting for the data to arrive from hard disk.
So, why would would several threads loading those images in parallel help here? 
In my thinking, they will just compete for the same resource, i.e., hard disk.


I also googled quite a bit, to no avail.

Any and all hints, suggestions, and insights will be highly appreciated!
Best, Gab


>


> if (!imageSourceRef)
> return;
>
> CFDictionaryRef props = CGImageSourceCopyPropertiesAtIndex(imageSourceRef, 0, 
> NULL);
>
> NSDictionary *properties = (NSDictionary*)CFBridgingRelease(props);
>
> if (!properties) {
> return;
> }
>
> NSNumber *height = [properties objectForKey:@"PixelHeight"];
> NSNumber *width = [properties objectForKey:@"PixelWidth"];
> int height = 0;
> int width = 0;
>
> if (height) {
> height = [height intValue];
> }
> if (width) {
> width = [width intValue];
> }
>
>
> Or this link by Ole Bergmann?
>
> https://oleb.net/blog/2011/09/accessing-image-properties-without-loading-the-image-into-memory/
>
> I love these questions.  I find out more about iOS programming by researching 
> other people’s problems than the ones that I’m currently faced with.
>
> Hopefully some of these will help.
>
> Cheers,
> Alex Zavatone



smime.p7s
Description: S/MIME cryptographic signature
___

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


dictionaryWithObjects:keys: looses elements

2023-01-03 Thread Gabriel Zachmann via Cocoa-dev
I have this line in my code:

NSDictionary * temp = [NSDictionary dictionaryWithObjects: imagefiles_ 
forKeys: datesAndTimes_ ];

The funny thing is:
the input arrays (imagefiles_ and datesAndTimes_) both have 17 elements;
however, the dictionary temp has only 7 elements afterwards!

In the debugger, both input arrays appear to be OK, nothing peculiar about them.

The array for the keys is constructed essentially the following way:

iso_date = [isoDateFormatter_ dateFromString: (__bridge NSString * 
_Nonnull)(dateref) ];
[datesAndTimes_ addObject: iso_date ];

(I also tried

[datesAndTimes_ addObject: [iso_date copy] ];

to no avail.)

The values array is constructed like this:

imagefiles_ = [NSMutableArray arrayWithArray: [filelist 
componentsSeparatedByString: @"\n"] ];


I'd be very grateful if anybody could shed some light on this.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-13 Thread Gabriel Zachmann via Cocoa-dev
>
> I mentioned somewhere in one of my replies that you know when it?s being run 
> in the System Prefs preview because isPreview is passed to the main entry 
> point.
>
>

I am not interested in detecting whether or not my screensaver is running in 
System Prefs preview.

I am interested in the *screen* on which I am running, irrespective of whether 
it's inside System Prefs or as a fullscreen screensaver.

Best regards, Gabriel


>> On Dec 11, 2022, at 14:56, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> ?Thanks again for the responses. And sorry for following up so much later.
>> (a bit of context is recapped below)
>>
>> First of all, thanks for the hint to viewDidMoveToWindow.
>>
>> So, currently , I do this in my viewDidMoveToWindow:
>>
>>
>> - (void) viewDidMoveToWindow
>> {
>>   window_ = [self window];
>>   NSUInteger idx_of_screen = [NSScreen.screens indexOfObject: 
>> window_.screen];
>>   displayID_ = [NSNumber numberWithUnsignedLong: idx_of_screen ];
>>
>>
>> On my Mac this runs fine, and I get a proper idx_of_screen/displayID_;
>>
>> However, one of my users sent me a log file, which shows that on his Mac, 
>> [self window] is non-null, but indexOfObject: returns NSNotFound, in the 
>> case where my screensaver is running in the preview of System Preferences.
>> (One difference between the systems is that I am still using macOS 12, while 
>> he is using macOS 13.)
>>
>> I guess, there is not much I can do about it, except find some kind of 
>> work-around for those cases, where this happens. Right?
>
>
> --
>
> Subject: Digest Footer
>
> ___
>
> Cocoa-dev mailing list  (Cocoa-dev@lists.apple.com)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
> https://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
> --
>
> End of Cocoa-dev Digest, Vol 19, Issue 65
> *



smime.p7s
Description: S/MIME cryptographic signature
___

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: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-11 Thread Gabriel Zachmann via Cocoa-dev
Thanks again for the responses. And sorry for following up so much later.
(a bit of context is recapped below)

First of all, thanks for the hint to viewDidMoveToWindow.

So, currently , I do this in my viewDidMoveToWindow:


- (void) viewDidMoveToWindow
{
window_ = [self window];
NSUInteger idx_of_screen = [NSScreen.screens indexOfObject: window_.screen];
displayID_ = [NSNumber numberWithUnsignedLong: idx_of_screen ];


On my Mac this runs fine, and I get a proper idx_of_screen/displayID_;

However, one of my users sent me a log file, which shows that on his Mac, [self 
window] is non-null, but indexOfObject: returns NSNotFound, in the case where 
my screensaver is running in the preview of System Preferences.
(One difference between the systems is that I am still using macOS 12, while he 
is using macOS 13.)

I guess, there is not much I can do about it, except find some kind of 
work-around for those cases, where this happens. Right?


Best regards, Gabriel



>
>> On Nov 17, 2022, at 16:11, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> ?Thanks a lot for your quick responses!
>>
>> I would like to understand what you are saying and what is going on, so 
>> please bear with me.
>>
>> So, Steve, if I understand correctly, you suggest to write:
>>
>> - (void) viewWillMoveToWindow: (NSWindow *) newWindow
>> {
>>   unsigned long my_screen = [NSScreen.screens indexOfObject: [newWindow 
>> screen]];
>>   displayID_ = [[ [NSScreen.screens[my_screen] deviceDescription] 
>> objectForKey: @"NSScreenNumber"];
>> ...
>> }
>
> No, I didn?t suggest that. I suggested just using the screen?s index via 
> indexOfObject as the screen number. No need to dive into the device 
> description. It?s exactly what I do my screensaver.
>
> I see in my code I only access the window.screen in viewDidMoveToWindow, not 
> viewWillMoveToWindow. Perhaps the window has not yet been assigned to a 
> screen in WillMove.
>



smime.p7s
Description: S/MIME cryptographic signature
___

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


How to convert path through container into standard form?

2022-12-11 Thread Gabriel Zachmann via Cocoa-dev

I have an NSURL * pictures_path;

By default, this is set to

  pictures_path = [ [NSFileManager defaultManager] URLForDirectory: 
NSPicturesDirectory
 inDomain: NSUserDomainMask
appropriateForURL: nil create: NO error: 
];

This works fine.

Occasionally, I am printing a log message, like so:

  mesg = [[NSMutableString alloc] initWithString: [mainDirectoryLocation_ 
pictures_path] ];

and then output that to whatever channel is active (screen or log file).

Now, in cases where pictures_path is still set to the default,
the users sees some thing like:

  
/Users//Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Pictures

which is confusing to the user (and takes up a lot of space).

How can I convert this back to the more human-readable /Users/xx/Pictures  or 
~/Pictures ?

I have checked NSURL's doc, but couldn't find a method to convert the path.


Hints will be appreciated.
Best, Gabriel.



smime.p7s
Description: S/MIME cryptographic signature
___

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: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your quick responses!

I would like to understand what you are saying and what is going on, so please 
bear with me.


So, Steve, if I understand correctly, you suggest to write:

- (void) viewWillMoveToWindow: (NSWindow *) newWindow
{
unsigned long my_screen = [NSScreen.screens indexOfObject: [newWindow 
screen]];
displayID_ = [[ [NSScreen.screens[my_screen] deviceDescription] 
objectForKey: @"NSScreenNumber"];
...
}

How is this better than using [newWindow screen] directly?

And how can it happen that [newWindow screen] is NULL, as Jack has cited from 
the docs, when my screensaver is running in System Preference's Preview window?
Only when I click on a different screensaver, then switch back to mine, does 
[newWindow screen] get a proper value, most of the time.


What about
  [NSScreen mainScreen]
?


> If a screensaver window is not onscreen, there?s no screen to save, so it 
> wouldn?t matter.

How can a screensaver get launched by macOS and *not* be on screen?
Note that viewWillMoveToWindow gets called inly once during the lifetime of a 
screensaver.

(Unless, maybe, it is running in System Preference's preview window, and the 
user moves the System Preferences window to a different screen. but that is of 
no concern right now.)


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Gabriel Zachmann via Cocoa-dev
In my screensaver (macOS),
I am trying to retrieve the 'screen number' (NSScreenNumber) for the screen on 
which I am running.

So, in
 - (void) viewWillMoveToWindow: (NSWindow *) newWindow
I have this line of code:
 displayID_ = [ [[newWindow screen] deviceDescription] objectForKey: 
@"NSScreenNumber"];

This sometimes works (I get the correct screen number),
and sometimes it does not, i.e., I get displayID_ = nil!
(Usually after invoking some other screen savers in System Preferences.)

I don't see a pattern.

Curiously, these lines in viewWillMoveToWindow always work:

for ( NSScreen * s in [NSScreen screens] )
{
NSDictionary * device_description = [s 
deviceDescription];
NSNumber * n = [device_description objectForKey: @"NSScreenNumber"];
[...]
}

I always get non-null and correct 'screen numbers' n.


So, I am wondering, why does the first line sometimes NOT work?
And what is the proper way to retrieve the screen number on which my screen 
saver is running?
Should I use [NSScreen mainScreen] ?

Please note, that there might be several monitors attached to the Mac!
(Some users have up to 6)

Thanks a lot in advance.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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 Options under macOS 13 (Ventura) doesn't work

2022-11-10 Thread Gabriel Zachmann via Cocoa-dev
>
>> On Nov 9, 2022, at 11:26, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> I asked them to send the log file, but I could not find anything elucidating 
>> in the log.
>
> You didn?t do something like change the min version for your config xib? If I 
> were you, I?d look at the dif of every file you?ve changed since you last ran 
> under the OS that?s having the problem.
>

It's actually the executable that runs fine under macOS 12.x, but under 13.0 
the Options button doesn't do anything.
so, no changes whatsoever.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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 Options under macOS 13 (Ventura) doesn't work

2022-11-09 Thread Gabriel Zachmann via Cocoa-dev

>
> I have a couple of custom screensavers where the button works, so it sounds 
> like this must be something with your setup. Perhaps looking at Console might 
> be helpful?
>

I asked them to send the log file, but I could not find anything elucidating in 
the log.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Screensaver Options under macOS 13 (Ventura) doesn't work

2022-11-06 Thread Gabriel Zachmann via Cocoa-dev
I've got a screensaver (sitting in System Preferences) that works fine under 
macOS 12.x and that still seems to work fine under macOS 13 (Ventura) -
except that users cannot open the "Options" dialog any more!
(I can't investigate directly, since I cannot upgrade to Ventura just yet).

My question is: does anyone know of any changes under macOS 13 that might 
prevent the Options pane from appearing?

I have already tried to recompile my screensaver for macOS 13 and sent it to 
the user, to no avail.
The log file they sent to me does not show anything - the Options dialog just 
does not open.
The Options button is not greyed out.

Any ideas will be highly appreciated.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2022-08-16 Thread Gabriel Zachmann via Cocoa-dev
That is a good idea.  Thanks a lot!

Maybe, I can turn this into more fine-grained, dynamic load balancing (or 
latency hiding), as follows:
create a number of threads (workers);
as soon as a worker is finished with their "current" image, it gets the next 
one (a piece of work) out of the list, processes it, and stores the iso_date in 
the output array (dates_and_times).
Both accesses to the pointer to the currently next piece of work, and the 
output array would need to be made exclusive, of course.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2022-08-15 Thread Gabriel Zachmann via Cocoa-dev
> I noticed you release the fileProps but didn’t release the image, but I don’t 
> know if that’s one of those details you left out for clarity.

Good point, and sorry for the confusion.
Yes, I do release the image.

> Also, depending on some factors like mutability, while the initWithString 
> call with a CFStringRef might essentially be a no-op, you can just do the 
> typecast on the dateref and pass it directly into dateFromString.

Thanks, that should work.

A detail I left out in-between: whitespace trimming.

Or, does anyone know if dateFromString will handle trailing/leading whitespaces 
gracefully?

>
> One thing I’d suggest is to do the work for each image asynchronously on a 
> background queue and have that block (essentially all of your for-loop code) 
> report its completion by some asynchronous way like posting a notification on 
> the original queue

Yes, I will try to do that, in particular, to let the user know about the 
progress.


G.



smime.p7s
Description: S/MIME cryptographic signature
___

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: Retrieving the EXIF date/time from 250k images

2022-08-15 Thread Gabriel Zachmann via Cocoa-dev
> I think an important question here is, what exactly are you trying to do? Do 
> you

Good point, I should have mentioned it:

I would like to sort the list of images by their EXIF date/time.

> really expect to process these images repeatedly? 3.5m for a quarter million 
> pics isn't terrible when one already possesses a working solution.

True.
But I was wondering if it is really the best solution.


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Retrieving the EXIF date/time from 250k images

2022-08-14 Thread Gabriel Zachmann via Cocoa-dev
I would like to collect the date/time stored in an EXIF tag in a bunch of 
images.

I thought I could do so with the following procedure
(some details and error checking omitted for sake of clarity):


NSMutableArray * dates_and_times = [NSMutableArray arrayWithCapacity: 
[imagefiles count]];
CFDictionaryRef exif_dict;
CFStringRef dateref = NULL;
for ( NSString* filename in imagefiles )
{
NSURL * imgurl = [NSURL fileURLWithPath: filename isDirectory: NO];
// escapes any chars that are not allowed in URLs (space, &, etc.)
CGImageSourceRef image = CGImageSourceCreateWithURL( (__bridge 
CFURLRef) imgurl, NULL );
CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex( image, 
0, NULL );
bool success = CFDictionaryGetValueIfPresent( fileProps, 
kCGImagePropertyExifDictionary, (const void **) & exif_dict );
success = CFDictionaryGetValueIfPresent( exif_dict, 
kCGImagePropertyExifDateTimeDigitized, (const void **) & dateref );
NSString * date_str = [[NSString alloc] initWithString: (__bridge 
NSString * _Nonnull)( dateref ) ];
NSDate * iso_date = [isoDateFormatter_ dateFromString: date_str];
if ( iso_date )
 [dates_and_times addObject: iso_date ];
CFRelease( fileProps );
}


But, I get the impression, this code actually loads each and every image.
On my Macbook, it takes 3m30s for 250k images (130GB).

So, the big question is: can it be done faster?

I know the EXIF tags are part of the image file, but I was hoping it might be 
possible to load only those EXIF dictionaries.
Or are the CGImage functions above already clever enough to implement this idea?


Best regards, Gab.




smime.p7s
Description: S/MIME cryptographic signature
___

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: Mystery interference with AirPlay

2022-06-16 Thread Gabriel Zachmann via Cocoa-dev
I must be doing something pretty stupid: I don't see all those buttons, neither 
on my iPhone nor on my Macbook Pro.

I tried these instructions:
  https://www.macrumors.com/how-to/airplay-from-iphone-to-mac/

with the TV app on iPhone.

iPhone 12 with iOs 15.5
MacbookPro 2019 with macOS 12.4


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Mystery interference with AirPlay

2022-06-16 Thread Gabriel Zachmann via Cocoa-dev
>
> I can’t point you in the right direction but find out what is acquiring the 
> audio device.  Start with your multimedia playback code.  What are you using 
> to play the ‘video’?

I am not playing any videos - I am only showing images.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Mystery interference with AirPlay

2022-06-15 Thread Gabriel Zachmann via Cocoa-dev
I am using only:

o NSBeep()
o NSSound
0 and link to these frameworks: CoreLocation, Foundation, Cocoa, ScreenSaver, 
QuartzCore, ApplicationServices, AppKit, Photos, MediaLibrary, IOKit

Does any of those cause trouble?

Best , G.




smime.p7s
Description: S/MIME cryptographic signature
___

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: Mystery interference with AirPlay

2022-06-15 Thread Gabriel Zachmann via Cocoa-dev
There is no sound whatsoever from my app.

Best, G.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Mystery interference with AirPlay

2022-06-15 Thread Gabriel Zachmann via Cocoa-dev
I have a macOS app that plays a slideshow, and no music/sound whatsoever.

One user has reported that whenever he launches my app, his music played over 
AirPlay stops.

Does anyone have an idea what might be causing this?
I have no clue where to search or what to look for.
Making matters worse, I don't have AirPlay.

Any and all ideas and hints will be highly appreciated.

Best, Gab.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Playing videos on CALayer ?

2022-03-28 Thread Gabriel Zachmann via Cocoa-dev

Currently, my app displays images on a CALayer,
with some basic animation like so:
  CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath: 
@"bounds.size"];

Now, I would like to include videos, too.

So, first of all, how would I put videos on such a CALayer, so that they get 
played while the layer is visible? (without sound)
Would that interfere with the animation?

Could some kind soul perhaps point me to some relevant literature,
or even to an example program?

Thanks a lot in advance.
Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Lock screen ?

2022-03-27 Thread Gabriel Zachmann via Cocoa-dev
> I did a similar thing for a remote control server I made for the Mac. You can 
> look at the window level or at capture screen depending on what you want to 
> achieve.

What does that mean?
Sorry , I am just a casual Mac programmer.
(I used to code under Unix/Linux in C++, now not so much software development 
any more, due to lack of time.)

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Lock screen ?

2022-03-27 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response and for your link!

> http://www.albertopasca.it/whiletrue/swift-c-lock-macos-programmatically/

Would a macOS appeasing that approach get through the app store approval 
process?

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Lock screen ?

2022-03-26 Thread Gabriel Zachmann via Cocoa-dev
Is it possible for a macOS app to lock the screen while it is running, so that 
users need to enter their password when clicking the mouse or hitting a 
specific key?
Similar to what macOS does when a screensaver is running?
In particular, is it possible to do so in full-screen mode?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Building for 10.12

2022-03-20 Thread Gabriel Zachmann via Cocoa-dev
>> My question now is: why did Xcode not warn me about that function, even 
>> though the deployment target was set to 10.12 ?
>   The deployment target not a compiler setting. It is more of a runtime 
> thing.  So if you set the deployment target to 13.0 it will not launch on 
> macOS 12, for

Oh, I see. That explains a lot.

> example.  The SDK is what determines what API are (not) available. So if you 
> were building against the 10.12 SDK you would have gotten a compiler error.

Sorry for asking (again?): how would I do that?
How do I install old SDK's on current Xcode / macOS?
How would I tell Xcode to use those old SDK's?
Is there an easy switch back and forth?

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Building for 10.12

2022-03-20 Thread Gabriel Zachmann via Cocoa-dev
I have now the crash report.

Apparently, this caused it:

  Symbol not found: _AVAudioSessionInterruptionNotification

Yes, I am using that function, and yes, it seems to be available only on macOS 
11 and higher.

My question now is: why did Xcode not warn me about that function, even though 
the deployment target was set to 10.12 ?
How can I prevent things like that happening in the future?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Building for 10.12

2022-03-18 Thread Gabriel Zachmann via Cocoa-dev
>>> Make sure you have the 10.12 SDK installed in your Xcode.  To find out 
>>> what

Actually, it seems I wouldn't need older SDK's any more, see, for instance:

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

And some people even say it could be harmful to have multiple SDK's with Xcode 
13 .

So, I guess, the crash is not caused by my machine not having the 10.12 SDK, is 
it?


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Building for 10.12

2022-03-18 Thread Gabriel Zachmann via Cocoa-dev
>> I am trying to build my app for macOS 10.12 (Sierra).
>>
>> First of all, is it correct that I need to build it for "My Mac" , not do a 
>> niversal build (Any Mac)?
>   If you are only building to debug it then My Mac is fine. But if you 
> are building to send out to customers then you want Universal.

So macOS 10.12 can "understand" universal builds?

>   Make sure you have the 10.12 SDK installed in your Xcode.  To find out 
> what OS SDK is installed in your selected Xcode run:
>
>   xcodebuild -version -sdk macosx
>

Thanks a lot!

Here is the complete output:

% xcodebuild -version -sdk macosx
2022-03-18 20:09:43.281 xcodebuild[40530:14001720] Requested but did not find 
extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications 
for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in 
com.apple.dt.IDEWatchSupportCore
2022-03-18 20:09:43.282 xcodebuild[40530:14001720] Requested but did not find 
extension point with identifier 
Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension 
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in 
com.apple.dt.IDEWatchSupportCore
MacOSX12.3.sdk - macOS 12.3 (macosx12.3)
SDKVersion: 12.3
Path: 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
PlatformVersion: 12.3
PlatformPath: 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
ProductBuildVersion: 21E226
ProductCopyright: 1983-2022 Apple Inc.
ProductName: macOS
ProductUserVisibleVersion: 12.3
ProductVersion: 12.3
iOSSupportVersion: 15.4

So, that means I do *not* have the 10.12 SDK , right?


Best regards, Gabriel






smime.p7s
Description: S/MIME cryptographic signature
___

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


Building for 10.12

2022-03-18 Thread Gabriel Zachmann via Cocoa-dev
I am trying to build my app for macOS 10.12 (Sierra).

First of all, is it correct that I need to build it for "My Mac" , not do a 
niversal build (Any Mac)?

Second, I have been switching the scheme to build for "My Mac", but when I 
archive it to notarize it and export it, I still get a universal app.
What gives?

BTW: I have sent such a build to a beta tester using 10.12, but he gets the 
error message
   "cannot be opened because of a problem".


Thanks a lot in advance.
Gab.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Building for 10.12

2022-03-18 Thread Gabriel Zachmann via Cocoa-dev
PS:

I have, of course, switched the Deployment Target to 10.12,
but I am working on macOS 12.1 and Xcode 13.3.

(Sorry for not mentioning earlier)



smime.p7s
Description: S/MIME cryptographic signature
___

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: New (?) behavior of screensavers wrt. keyboard clicks

2022-03-17 Thread Gabriel Zachmann via Cocoa-dev
Thanks a million. That fits the bill.

Best regards, Gabriel


> On 17. Mar 2022, at 14:23, Richard Somers  wrote:
>
> Perhaps this may help.
>
> https://discussions.apple.com/thread/8329971
>
> Best regards, Richard
>
>
>> On Mar 17, 2022, at 4:59 AM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> Thanks a lot.
>>
>> So it's rather a glitch on my machine, I guess.
>> On my end, the "alert" sound occurs with Apple's screensavers, too.
>>
>> Best regards, Gabriel
>>



smime.p7s
Description: S/MIME cryptographic signature
___

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: New (?) behavior of screensavers wrt. keyboard clicks

2022-03-17 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot. 

So it's rather a glitch on my machine, I guess. 
On my end, the "alert" sound occurs with Apple's screensavers, too.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


New (?) behavior of screensavers wrt. keyboard clicks

2022-03-15 Thread Gabriel Zachmann via Cocoa-dev
It used to be the case that a screensaver (launched by macOS) was terminated as 
soon as the user wiggled the mouse, or clicked a keyboard key.

Now, at least on my macbook, I just get the alert sound (a blip in my case).
It sounds as if there was an app that didn't respond to the event.
(Yes, I haven't used screensavers in a long time.)

The only way to stop the screensaver is a mouse click.

Is that normal?
If not, what might be causing it? (i could reboot, of course, but i'm 
interested in insights)
If yes, does anyone have an idea what is the rationale?

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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 with rangeOfString and Umlauts

2022-03-14 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your insights!

(I'm cc'ing the mailinglist, just in case someone else later stumbles across 
this.)

Best, G.


> On 14. Mar 2022, at 14:57, Aandi Inston  wrote:
>
> This is largely from memory, so details might be wrong.
> Normalisation is an insufficiently known thing to consider when working with 
> Unicode.  (We all know that Unicode is a list of code points (integers).
>
> Here are some Unicode points for this discussion:
> U+0065 "e" Latin Small Letter E
> U+00E9 "é" Latin Small Letter E with Acute
> U+0301 "◌́" (U+0301) Combining Acute accent - this may not display as expected
> Many languages have accents that change letters, so we have "e" plus "acute" 
> to get "e acute". In Unicode there are two ways to get "e acute". One is the 
> single Unicode point U+00E9. The other is the TWO characters "e" and 
> "combining acute accent", so U+0065 followed by U+0301. U+0301 does not take 
> any space for itself, but dumps an acute accent over the character 
> before.(Not all accented letters have two representations like this, and some 
> have more than two).
> So, what's the difference between U+00E9 versus U+0065 followed by U+0301? 
> They will look the same, but a string with the second form will be 1 
> character longer, and the offset of all character after it will be changed.
> Are they equal? Well, no, not in simple terms because they are different list 
> of characters.
> Do we get both? YES. The Mac OS file systems store the long form. On a French 
> keyboard, if you type e acute, you get the short form. If you copy paste it 
> could be either. This can be bad. For example if you get a list of the files 
> in a folder, and allow the user to type a name to choose the file, there 
> might not be a match, even though the user can see one.
> To get over this, we have "canonical" forms. There are at least four forms, 
> C, D, KC and KD. precomposedStringWithCanonicalMapping converts to form C. It 
> doesn't really matter what it is, but if you run all your strings through 
> precomposedStringWithCanonicalMapping, then you will get more expected 
> results when comparing strings.
>



smime.p7s
Description: S/MIME cryptographic signature
___

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 with rangeOfString and Umlauts

2022-03-14 Thread Gabriel Zachmann via Cocoa-dev
>
> It’s hard to tell from the above snippet, but I suspect your strings are 
> different in normalization.

I suspected that, too, but I have no expertise in normalization.

> Specifically, I suspect that file_basename uses two Unicode codepoints for 
> the ä, and info_item uses only one.
>
> As an experiment, try running both strings through 
> -precomposedStringWithCanonicalMapping before doing

Thanks a lot!
That seems to solve the problem.
I have looked up the documentation of the method, but I don't really understand 
it.
Could you explain it to me?


To gain more insights (I usually think it's better to understand in depth what 
one is doing),
here is some more background info:

One of the strings is derived from a path, like so:

query_ = [[NSMetadataQuery alloc] NSPredicate * predicate = [NSPredicate 
predicateWithFormat: @"(kMDItemContentTypeTree = 'public.image')" ];
[query_ setSearchScopes: [NSArray arrayWithObject: mainDirectoryLocation_]];
[query_ setPredicate: predicate];
[query_ startQuery];
 .
NSString * img_filename = [[query_ resultAtIndex: i] valueForAttribute: 
@"kMDItemPath"];
file_basename = [[img_filename lastPathComponent] 
stringByDeletingPathExtension];



The other string is derived from EXIF data, like so:

CFDictionaryRef tiff_dict;
CFDictionaryGetValueIfPresent( fileProps, kCGImagePropertyTIFFDictionary, 
(const void **) & tiff_dict );

CFDictionaryGetValueIfPresent( tiff_dict, kCGImagePropertyTIFFImageDescription,
 (const void **) & caption 
);
info_item = [[NSString alloc] initWithString: (__bridge NSString * 
_Nonnull)(caption)];


Could that explain the funny handling of umlauts I am seeing?

In particular, in the debugger, I can see that the type of  file_basename  is 
actually an (NSPathStore2 *).
Could that be a problem?



Thanks a lot in advance.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Problem with rangeOfString and Umlauts

2022-03-11 Thread Gabriel Zachmann via Cocoa-dev

Well, SSIA.
In more detail, I've got two strings:

file_basename = @"Morgendämmerung (1)"
info_item = @"Morgendämmerung"

This code

NSString * prefix = [ info_item commonPrefixWithString: file_basename 
options: NSCaseInsensitiveSearch ];
unsigned int prefix_len = (unsigned int) [prefix length];

yields prefix_len = 15
as it should.

The problem arises with this line of code:

NSRange space_in_filename = [file_basename rangeOfString: @" " options: 
NSDiacriticInsensitiveSearch|NSCaseInsensitiveSearch|NSWidthInsensitiveSearch];

which yields space_in_filename.location = 16 !

This thwarts the rest of the code, which, in this case, would expect 
space_in_filename.location = 15.

Needless to say that with strings that do not contain Umlauts, the call of 
rangeOfString:options: works as expected, i.e., in the above example 
space_in_filename.location is as expected (i.e., first character has 
location=0).

I have also tried localizedStandardRangeOfString, with the same effect.

Any ideas what I can do?


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-14 Thread Gabriel Zachmann via Cocoa-dev

>
> In Monterey, /tmp is now only writeable by root.

It is?
I have been storing temp files in /tmp all my life (output from all kinds of 
programs), and did not notice a change when upgrading to Monterey.

/Users/zach% cd /tmp
/private/tmp% ls -ld .
drwxrwxrwt  17 root  wheel  544 Feb 14 12:00 ./

/private/tmp% ll
total 164008
drwxr-xr-x@ 7 zach  wheel   224B Feb 14 14:19 
ArtSaver-hcwtwqkubldekzfijehvpaeowamp/
drwxr-xr-x  3 zach  wheel96B Feb 13 23:02 Build/
drwxr-xr-x  5 zach  wheel   160B Feb 13 23:02 ModuleCache.noindex/
drwxr-xr-x  3 zach  wheel96B Feb 13 21:59 SymbolCache.noindex/
drwxr-xr-x  3 zach  wheel96B Feb 13 21:59 XCBuildData/
[...]


Maybe, the sticky bit is new as of Monterey?
(which would make sense, of course, but maybe it was there all the time, which 
it should.)
Even so, a reboot should have cleared up any permission problems in any case, 
since a reboot deletes all files in /tmp anyways.

So, I'm still a bit in the dark as to why it now works.
Oh well ...


> It is quite possible that Xcode couldn?t write there for the indexing.

It looks like it, but I can't see why 


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-13 Thread Gabriel Zachmann via Cocoa-dev
> This seems to indicate an error somewhere in the Xcode prefs.

Oh, wow, maybe I have resolved the issue!

The Derived Data directory is set to /tmp (i have had that setting for years).

Now, in Xcode / Preferences / Locations / Derived Data / Advanced,
I set Custom = Relative to Derived Data.
(Before , it was set to Absolute.)
I have no idea, why it would not do the indexing before, and exactly what the 
setting "Absolute" means,
but it looks like now it's working!

Thanks a million to you all!

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-13 Thread Gabriel Zachmann via Cocoa-dev
>
> Sort of straw-grasping I would try with Xcode under these circumstances?
>
> Try changing the target CPU/OS setting to something else, build, and see if 
> the indexing works.
>
> If it does, make the minimal changes needed to appropriately build your 
> target.
>

Thanks a lot for the straw , alas, it didn't work.
I changed all kinds of things, to no avail.
In other projects,  I get the indexing progress circle just fine.
in the problem project, I get it for a second, then it goes away and I get the 
crash messages in the report navigator.





smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-13 Thread Gabriel Zachmann via Cocoa-dev
This is, indeed, strange.

I tried it, as you suggested, with a new user account on the very same machine.
Everything works just fine in a copy of the project under that pristine account.
Even when I launch the .xcodeproject in my real home, the indexing works.

It just does not work in my home.

Just now, I have tried a few other things.
I deleted some folders in ~/Library/Deverlopers (caches, log files, devices).
Interestingly, there is no ~/Library/Deverloper/Xcode/DerivedData! (which 
should contain the indexing stuff; and, naturally, 
~pristine/Library/Developer/Xcode does contain the DerivedData).
I have also rebooted.
I also deleted project.xcworkspace .
All to no avail.

So, what now? what can I do?

Stymied, Gabriel.



smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-12 Thread Gabriel Zachmann via Cocoa-dev
Here is another attempt at getting to the root of the indexer problem I am 
experiencing.

First of all, thanks a lot for your helpful hints, albeit they did not resolve 
the issue.

Here is - for recap - the description in a nutshell of my original post:


 A few weeks ago, indexing in Xcode 13 stopped working for one of my 
 projects.
 So, for instance, "Jump to Definition" does not work any more.
 I don't know what stopped indexing to work.


I have now tried executing the command you can find in the log window of Xcode 
(Report Navigator),
which leads to all the crashes.
(Below, you can find the command for my case.)

The output in the shell was this:
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see 
invocation)
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-macos10.14
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: error: unable to execute command: Segmentation fault: 11
clang: note: diagnostic msg: Error generating preprocessed source(s).

So, I issued the command again with -v, which revealed the "invocation".
(See below that invocation command.)

Issuing that clang command produced just this error message:

clang -cc1 version 13.0.0 (clang-1300.0.29.30) default target 
x86_64-apple-darwin21.2.0
Segmentation fault


So, I am nowhere closer to the root of the problem.


Does anyone have an idea, how i might get more information?


Best regards, Gabriel




Encl.:

Orig. clang command as reported in the Report Navigator:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 -x objective-c -target x86_64-apple-macos10.14 -fmessage-length=0 
-fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 
-fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/tmp/ModuleCache.noindex 
-fmodules-prune-interval†400 -fmodules-prune-after45600 
-Wnon-modular-include-in-framework-module 
-Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings 
-O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes 
-Werror=return-type -Wdocumentation -Wunreachable-code 
-Wno-implicit-atomic-properties -WerrorÞprecated-objc-isa-usage 
-Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak 
-Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces 
-Wparentheses -Wswitch -Wunused-function -Wno-unused-label 
-Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body 
-Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wshadow 
-Wno-four-char-constants -Wconversion -Wconstant-conversion -Wint-conversion 
-Wbool-conversion -Wenum-conversion -Wfloat-conversion 
-Wnon-literal-null-conversion -Wobjc-literal-conversion -Wsign-compare 
-Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector 
-Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations 
-DDEBUG=1 -DDEBUG=1 -DSTAND_ALONE_APP=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 
-isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
 -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g 
-Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing 
-Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability 
-index-store-path /tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/DataStore 
-iquote 
/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/ArtSaverApp-generated-files.hmap
 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/ArtSaverApp-own-target-headers.hmap
 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/ArtSaverApp-all-target-headers.hmap
 -iquote 
/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/ArtSaverApp-project-headers.hmap
 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Products/Debug/include 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/DerivedSources-normal/x86_64
 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/DerivedSources/x86_64
 
-I/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Intermediates.noindex/ArtSaver.build/Debug/ArtSaverApp.build/DerivedSources
 -F/tmp/ArtSaver-hcwtwqkubldekzfijehvpaeowamp/Index/Build/Products/Debug 
-fsyntax-only /Users/zach/Code/ArtSaver/ArtSaverApp/AppDelegate.m -o 
/tmp/ArtSaver.build/Debug/ArtSaverApp.build/Objects-normal/x86_64/AppDelegate.o 
-Xclang -fallow-pcm-with-compiler-errors -ivfsoverlay 

Re: Indexing broken for one project

2022-02-06 Thread Gabriel Zachmann via Cocoa-dev
> I have come across issues where a code syntax error messes up indexing—are 
> you able to do a full, successful compilation?

Yes, I think so.

Have done Product / Clean Build Folder ,
then quit Xcode, then launched again.
The project builds fine, no warnings.

But I still have a hunch it's in the source code.
I just have no idea how to pinpoint the place.

> Other than that, I have heard that some issues might require a system 
> restart, i.e. 1) quitting Xcode; 2) deleting derived data (if you use a 
> shared location you might also want to delete or move derived data from other 
> projects); and 3) restarting the computer.

I have just tried that , still no luck.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Indexing broken for one project

2022-02-06 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response.

I had tried that already, to no avail.

I am seeing lots of   "Crash detected during compilation"
in Xcode's indexing log.

Best regards, Gabriel



> On 6. Feb 2022, at 19:18, Rob Petrovec  wrote:
>
> Quit Xcode, delete the DerivedData directory for your project and re-open 
> your project.  That should trigger a re-index and a full rebuild of your 
> product.
>
> The default location for the DerivedData directory is in 
> ~/Library/Developer/Xcode/DerivedData/- letters>.  You can also configure it to be in your source directory, like I 
> do, so you can keep your build products with your code.
>
> Hope that helps.
>
> —Rob
>
>
>> On Feb 6, 2022, at 6:20 AM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>>
>> A few weeks ago, indexing in Xcode 13 stopped working for one of my projects.
>> So, for instance, "Jump to Definition" does not work any more.
>> I don't know what stopped indexing to work.
>>
>> The project consists of objective-c source code.
>> For other projects, indexing still works fine.
>>
>> I have tried to delete Derived Data (which, in my case, is stored under 
>> /tmp).
>> I have also tried to follow these instructions
>>  https://levelup.gitconnected.com/uncovering-xcode-indexing-8b3f3ff82551
>> and perused the log file, but I could not see any error messages.
>>
>> Any ideas what else I can try?
>> Could it be something in the source code / header files?
>> (The project compiles just fine, though.)
>>
>> Best regards, Gabriel
>>
>> ___
>>
>> 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/petrock%40mac.com
>>
>> This email sent to petr...@mac.com
>



smime.p7s
Description: S/MIME cryptographic signature
___

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


Indexing broken for one project

2022-02-06 Thread Gabriel Zachmann via Cocoa-dev
PS:
I have also done this
   defaults write com.apple.dt.Xcode IDEIndexShowLog -bool YES

Now, in the indexing log I can see in Xcode, there are a lot of messages
   "Crash detected during compilation".
But I still don't get a clue as to what might be causing this.





smime.p7s
Description: S/MIME cryptographic signature
___

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


Indexing broken for one project

2022-02-06 Thread Gabriel Zachmann via Cocoa-dev
A few weeks ago, indexing in Xcode 13 stopped working for one of my projects.
So, for instance, "Jump to Definition" does not work any more.
I don't know what stopped indexing to work.

The project consists of objective-c source code.
For other projects, indexing still works fine.

I have tried to delete Derived Data (which, in my case, is stored under /tmp).
I have also tried to follow these instructions
  https://levelup.gitconnected.com/uncovering-xcode-indexing-8b3f3ff82551
and perused the log file, but I could not see any error messages.

Any ideas what else I can try?
Could it be something in the source code / header files?
(The project compiles just fine, though.)

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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


Photos access under macOS Monterey ?

2022-01-14 Thread Gabriel Zachmann via Cocoa-dev
I was wondering if anything regarding the accessing of photos has changed under 
macOS Monterey or Big Sur.

For a number if macOS generations, it was no longer possible to access the 
photos from an app using PhotoKit.
Even with the proper capabilities this was not possible any more, because, 
unlike under iOS, under macOS some crucial functions are missing.

Now one user has sent me a screenshot that lists my app under System 
Preferences / Security & Privacy / Privacy / Photos.
Does that mean anything? does it mean I could access the photos again?

Curiously, my app (very same version) is not listed on my Mac!
Why is that?

All kinds of insights will be appreciated.

Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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: Sandboxing question regarding ~/Pictures

2021-09-27 Thread Gabriel Zachmann via Cocoa-dev
Yes, my app does have that entitlement:

com.apple.security.app-sandbox

com.apple.security.application-groups

V362FCBY2W.de.zach.ArtSaverGroup

com.apple.security.assets.pictures.read-write

com.apple.security.files.user-selected.read-write

com.apple.security.get-task-allow

com.apple.security.personal-information.photos-library



> On 27. Sep 2021, at 15:41, Sandy McGuffog  wrote:
> 
> The sandbox is an enigma wrapped in a mystery. But you might need to look at 
> the the com.apple.security.assets.pictures.read-write entitlement
> 



smime.p7s
Description: S/MIME cryptographic signature
___

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


Sandboxing question regarding ~/Pictures

2021-09-27 Thread Gabriel Zachmann via Cocoa-dev
I guess i still haven't understood something about sandboxing or entitlements.

I am trying to access the user's ~/Pictures folder, and also create a 
security-scoped bookmark (SSB) for that folder.

Under the target's Signing & capabilities section, File Access Type, I have set 
"Pictures Folder" to read/write.

Getting the path using this
NSURL * pic_dir = [ [NSFileManager defaultManager] URLForDirectory: 
NSPicturesDirectory
  inDomain: 
NSUserDomainMask
 appropriateForURL: nil 
create: NO error: ];

and doing a spotlight search over the folder works just fine.

However, creating a SSB for pic_dir does not work.

I am trying to create it like this:

NSData * dir_bookmark = [dir bookmarkDataWithOptions: 
NSURLBookmarkCreationWithSecurityScope
   includingResourceValuesForKeys: nil
relativeToURL: nil
error: ];

But I get this error:

Error Domain=NSCocoaErrorDomain Code=256 "Could not open() the item" 
UserInfo={NSURL=file:///Users/zach/Library/Containers/de.zach.ArtSaverApp/Data/Pictures/,
 NSDebugDescription=Could not open() the item}!


All of this is happening under macOS 11.5.2 .

Any insights will be highly appreciated.
G.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Accessing ~/Pictures under Mojave from screensaver ?

2021-09-26 Thread Gabriel Zachmann via Cocoa-dev
In  my screensaver, I'd like to search the ~/Pictures for images.
I would like to use that folder as a default, without requiring the user to 
open it for me.

Under macOS Mojave (10.14), the ScreenSaverEngine has these entitlements:

com.apple.developer.extension-host.screensaver

com.apple.security.cs.disable-library-validation


(AFAIK)

My question is: would these allow me to access ~/Pictures without any user 
intervention?
If yes, what would be the easiest/robust way to get the directory?
Should I just use:

dir = [ [NSFileManager defaultManager] URLForDirectory: NSPicturesDirectory
   inDomain: NSUserDomainMask
  appropriateForURL: nil create: NO error: ];


Thanks a lot in advance.
G.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Entitlements of ScreenSaverEngine under macOS Mojave (10.14)

2021-09-20 Thread Gabriel Zachmann via Cocoa-dev
Does anybody still have access to a Mac running Mojave? (10.14)

If yes, could you please send me the output of 

codesign -dvvv --entitlements :- 
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine

(I hope it is the correct path.)

What I am interested in is the entitlements of the screen saver engine under 
Mojave.

Thanks a lot in advance.

Gab.



smime.p7s
Description: S/MIME cryptographic signature
___

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: App can't be opened

2021-09-15 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for the insight.
Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

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   4   >