Re: Setting app icon in NSWorkspace

2024-03-22 Thread Alex Zavatone via Cocoa-dev
That’s a great idea.

For a Mac app, I suppose.

I wonder if a simple change in the bundle where you have the icon file be 
symlink to a folder in the app’s documents folder and then change that file?

What if you issue a shell script to restart the Dock?  

What happens if you change the icon manually through get info?  Can you 
duplicate your app, change the icon manually and diff the two apps to see where 
the differences are?  Then change the icon using NSWorkspace and compare the 
difference.

It surprises me that NSWorkspace breaks code signing.

Let me see what I can look in to.

Cheers,
Alex Zavatone

> On Mar 22, 2024, at 8:23 AM, Mark Allan via Cocoa-dev 
>  wrote:
> 
> Hi all,
> 
> I'm trying to offer my users the option (via a pre-defined list in my app's 
> Preferences) to choose an app icon which shows up in the Dock and the Finder.
> 
> Updating the Dock tile whilst the app is running is fairly simple to achieve, 
> but I also want the Dock icon and Finder icons to remain customised even when 
> the app isn't running. 
> 
> I have the following 
>   [[NSWorkspace sharedWorkspace] setIcon:newAppIcon forFile:[[NSBundle 
> mainBundle] bundlePath] options:0];
> 
> This works, but has the unfortunate side-effect of breaking code signing!
> 
> Can anyone help with this please?
> 
> The folks at Panic have managed to do it with Nova, so it must be possible, I 
> just can't figure it out.
> 
> Thanks
> Mark
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Xcode interferes with signal handler

2024-01-31 Thread Alex Zavatone via Cocoa-dev
Hi Gabriel.  Happy that you’re getting some progress.  Did Jens’s reply not 
explain why it would be interfered with when running in the debugger?

> On Jan 31, 2024, at 10:33 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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?
>> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Xcode interferes with signal handler (was: Sending SIGUSR1 to a process)

2024-01-31 Thread Alex Zavatone via Cocoa-dev
That’s a great tip Jens.  Gabriel, if you build your app with different 
dev/release schemes, you could detect your build scheme and then execute the 
desired process based on if you’re able to debug or not.  

Just expose the environment variable for $CONFIGURATION in an info.plist file, 
read it into a variable and then manage your response based on what the value 
is.  If you want details on that, contact me off list and I’ll show you.

Reference:
https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html

Hopefully, Jens’s tip will get you what you need!

Best,
Alex Zavatone

> On Jan 31, 2024, at 12:20 AM, Jens Miltner via Cocoa-dev 
>  wrote:
> 
> Xcode intercepts signals in the process being debugged (for good reason).
> You can ignore specific signals in Xcode (i.e. pass them through to the 
> process being debugged) by breaking into the debugger, then enter in the 
> Xcode console part (example for SIGUSR1):
> 
>   process handle SIGUSR1 -s false
>   process handle SIGUSR1 -p true
> 
> HTH,
> -jens
> 
> 
>> Von: Gabriel Zachmann 
>> Betreff: Xcode interferes with signal handler (was: Sending SIGUSR1 to a 
>> process)
>> Datum: 30. Januar 2024 um 20:31:45 MEZ
>> An: "cocoa-dev@lists.apple.com" 
>> 
>> 
>> 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
>> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Sending SIGUSR1 to a process

2024-01-29 Thread Alex Zavatone via Cocoa-dev
A long time ago, I was issuing terminal commands from Xcode.  

I’ve got a simple console app that executes a SIP export to PDF and another 
case where I was executing a sleep of the current process.  

You can even execute an Applescript to perform a terminal command.

This may help.  

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

Cheers,
Alex Zavatone

> On Jan 29, 2024, at 1:06 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Accessibility Settings

2024-01-11 Thread Alex Zavatone via Cocoa-dev
I’m sure there is an easier way to do this but well, I don’t know what it is.

In the System Settings: Accessibility: Display: Text, I set my font size to 13.

There is a database is located at /Library/Application 
Support/com.apple.TCC/TCC.db . To query the database from the command line, use 
sqlite3 or an SQL browser (I used DB Browser).

The modification date of that file does not reflect that it was just modified 
and there is no 13 in it. (I copied the file to another directory to view)

In the file in the access table, I found entries for many of the app bundle 
identifiers, but nothing for text and nothing with a 13 in it.

Ideally I’d search the entire drive for a mod date of today and locate that 
file, but I’ll leave that up to you.

Good luck.  Let us know what you find.

Cheers,
Alex Zavatone



> On Jan 11, 2024, at 10:58 AM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> I had to do something like that on iOS a few years back.  Let me see if I 
> have a solution for MacOS.
> 
> Cheers, 
> Alex Zavatone
> 
>> On Jan 10, 2024, at 10:48 AM, Tom Doan via Cocoa-dev 
>>  wrote:
>> 
>> I'm trying to figure out how to query the value for the 
>> Accessibility---Display---Text Size for MacOS (Objective-C). I can't 
>> for the life of me find any documentation on it, and anything that 
>> looks even close appears to be for iOS and Swift. Can anyone point 
>> me in the right direction?
>> 
>> Best regards,
>> 
>> Tom Doan
>> ---
>> Estima
>> 2717 Harrison St
>> Evanston, IL 60201
>> USA
>> 
>> 
>> ___
>> 
>> 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/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Accessibility Settings

2024-01-11 Thread Alex Zavatone via Cocoa-dev
I had to do something like that on iOS a few years back.  Let me see if I have 
a solution for MacOS.

Cheers, 
Alex Zavatone

> On Jan 10, 2024, at 10:48 AM, Tom Doan via Cocoa-dev 
>  wrote:
> 
> I'm trying to figure out how to query the value for the 
> Accessibility---Display---Text Size for MacOS (Objective-C). I can't 
> for the life of me find any documentation on it, and anything that 
> looks even close appears to be for iOS and Swift. Can anyone point 
> me in the right direction?
> 
> Best regards,
> 
> Tom Doan
> ---
> Estima
> 2717 Harrison St
> Evanston, IL 60201
> USA
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Avoiding leaks with "initWithCGImage"

2023-08-23 Thread Alex Zavatone via Cocoa-dev
Got a small sample we could play with?  I would expect the crash on explicit 
release as it would cause a double release.

I tend to ignore I strums to with leaks and use the Memory Graph debugger 
religiously.

If you have a little sample showing this, I would be happy to test a bit with 
it.

Cheers,
Alex Zavatone

Sent from my iPad

> On Aug 23, 2023, at 5:48 PM, JPH via Cocoa-dev  
> wrote:
> 
> Hello friends,
> 
> The enclosed procedure is producing a NSImage from  another NSImage, by 
> cropping in a NSRect.
> The resulting sub-Image feeds  an imageView  in the APP Interface and the may 
> change frequently,  then being hopefully disposed by ARC
> The last line of the procedure :
> NSImage *subImage = [[NSImage alloc] initWithCGImage:subImageRef 
> size:NSZeroSize];
> Generates a leak problem.
> 
> it is quite unclear if i should release or not  the  subImageRef.
> 
> If I release,  the app crashes soon after.
> If I don’t release, Instrument/Leaks reports a leak  of subImageRef  after 
> each call.
> 
> Obviously, ARC never releasessubImageRefwhich, as far as I 
> understand, is owned by the  subImage after the call.
> 
> Digging the web , apple doc, and various AI, did not provide a solution to 
> this dilemme.
> 
> I would greatly appreciate some help on this
> 
> Happy summer.. 
> JP
> 
> C
> //=
> + (NSImage *)getSubImageFromImage:(NSImage *)image atRect:(NSRect)rect
> //=
> {
>  // Convert the NSImage to a CGImageRef
>  CGImageRef imageRef= nil, subImageRef= nil;
>  imageRef = [image CGImageForProposedRect:NULL context:nil hints:nil];
>  if (imageRef == nil ) {  return nil; } // Failed to create CGImageRef
>  // Get the subimage from the CGImageRef
>  subImageRef = CGImageCreateWithImageInRect(imageRef, rect);
>  CFRelease(imageRef);
>  if(subImageRef == nil ) {  return nil;  }  // Failed to create subImageRef
>  // Convert the subimage CGImageRef to an NSImage
>  NSImage *subImage = [[NSImage alloc] initWithCGImage:subImageRef 
> size:NSZeroSize];
> //   CFRelease(subImageRef); // it is quite unclear if i should release the  
> subImageRef
> //If I release, the app crashes soon after.
> // If i dont release Instrument/Leaks report a leak at next call.
> // The subImage goes to a NSbutton in the interface, and will also soon be 
> replaced by another one, producing a leak of subImageRef
> 
>  return subImage;
> }// getSubImageFromImage
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: Full-screen not working

2023-08-18 Thread Alex Zavatone via Cocoa-dev
Gabe, I wonder if you can manually mess up your pList settings (keep a working 
copy) to see if this replicates any of the issues you see.

Cheers from Windhoek,
Alex Zavatone

> On Aug 15, 2023, at 8:24 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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?
> 
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Full-screen not working

2023-08-15 Thread Alex Zavatone 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. 
 Sorry, I can’t help more at the moment.  Greetings from the deepest darkest 
jungles of suburban Windhoek.

Alex Zavatone

Sent from my damn pain in the ass iPhone.

> On Aug 15, 2023, at 12:31, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: Screensaver options: nothing clickable

2023-08-13 Thread Alex Zavatone via Cocoa-dev
I reported that to you as well if you look at my older replies.

Greetings from Etosha.

> On Aug 13, 2023, at 8:49 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Substitute for kill(2)?

2023-07-25 Thread Alex Zavatone via Cocoa-dev
What if you called a method in the other process and the other process kills 
itself with a kill?  

Is kill no longer functional from any process?

> On Jul 25, 2023, at 2:49 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
> 
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: How do decipher an exception in the log file

2023-07-18 Thread Alex Zavatone via Cocoa-dev
Look in the second line.  It’s cratering within setLegacyModelView of your view 
controller.
Then in the 3rd, it’s saying that the index value of the array is invalid, it’s 
9223372036854775807.

So, it’s trying to set the view and the index is clearly the result of a bad 
pointer.  Gotta run or we could say why.

GL.

> On Jul 18, 2023, at 11:28 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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]
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Log file not showing all messages

2023-07-14 Thread Alex Zavatone via Cocoa-dev
I added an internal log file that only keeps the most recent 10,000 lines of 
logging and then save it internally.  There is an option within my old app that 
lets the user email that to me with the click of a button.  It’s been foolproof.

Might work for you.

Cheers,
Alex Zavatone

> On Jul 14, 2023, at 8:09 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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.
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Retrieving the EXIF date/time from 250k images

2023-07-07 Thread Alex Zavatone via Cocoa-dev
I’ll support Jim Crate’s suggestion of EXIFTool. I just came across this the 
other day while trying to remove the GPS location from a QuickTime video once I 
had copied it to my Mac.  Honestly, the quickest solution for me was to open it 
on another Mac in QuickTime 7 Pro, press command J, delete the EXIF tracks and 
save a new copy.

Ohh, how I wish I had my hands on the olden source for the QuickTime 7 Player.  
IIRC at one time, there was some Apple source code on the developer site.  
Should have snagged it while I had a chance.

Regarding Jim’s thought of NSTask being too slow, if you do take this route, I 
wonder how better spawning up to 4 NSTasks would be to grab this info. Examine 
the time of one fetch until diminishing results are returned, then match that 
to the # of CPU cores and drive throughput.  I love these kind of things.  It’s 
a case of, “well, this sucks.  Can we make it quicker and if we can, can we 
keep doing it until it stops sucking and actually make it good enough?”

Cheers and happy Friday,
Alex Zavatone



> On Jan 15, 2023, at 5:59 PM, James Crate  wrote:
> 
> There is a perl program called exiftool that can load and set exif tool 
> without loading the image data (or at least it doesn’t decode the image 
> data). I don’t know whether it would be faster than loading image 
> data/properties with ImageIO. You could write a perl script that used your 
> bundled exiftool to load the exif data and output the results for many files 
> in a format your program could handle, because instantiating perl/exiftool 
> repeatedly for each image in a separate NSTask would probably be pretty slow. 
> 
> Jim Crate
> 
> 
>> On Jan 7, 2023, at 2:07 PM, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> Hi Gabe.  I’d add basic logging  before you start each image and after you 
>> complete each image to see how much each is taking on each of problem tests 
>> so you can see the extent of how slow it is on your problem platforms.
>> 
>> Then you can add more logging to expose the problems and start to address 
>> them once you see where the bottlenecks are.
>> 
>> 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.
>> 
>> Cheers,
>> Alex Zavatone
>> 
>>> On Jan 7, 2023, at 12:36 PM, Gabriel Zachmann  wrote:
>>> 
>>> 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( fileP

Re: Screensaver running only on one display with a multiple display setup

2023-06-12 Thread Alex Zavatone via Cocoa-dev
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.

Alex Zavatone

> On Jun 12, 2023, at 7:23 AM, Steven Mills via Cocoa-dev 
>  wrote:
> 
> On Jun 10, 2023, at 12:45, Gabriel Zachmann via Cocoa-dev 
>  wrote:
>> 
>> 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).
> 
> By logging when init and viewDidMoveToWindow methods, you can see when the 
> latter fails to be called. It's a bug Apple needs to fix. 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.
> 
> --
> Steve Mills
> Drummer, Mac geek
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: NSScreen.screens under multiple displays

2023-06-08 Thread Alex Zavatone via Cocoa-dev
I have a 2 screen system running Ventura and another 3 screen system but not 
under Ventura.  

I could build and test for you if you wish.

> On Jun 8, 2023, at 11:53 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Alex Zavatone 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-04-30 Thread Alex Zavatone via Cocoa-dev
What I tested was if it matched the Xcode memory pie chart across several apps.

I can’t remember what results I got with terminal leaks or heap commands.

Add it to one of your programs and give it a shot!  Now I’m interested.

Cheers,
Alex Zavatone

> On Apr 30, 2023, at 1:33 PM, Rob Petrovec  wrote:
> 
> Curious, Alex, what does this memoryFootprint function show that running 
> ‘footprint’ or ‘heap’ in Terminal doesn’t?
> 
> —Rob
> 
> 
>> On Apr 30, 2023, at 8:12 AM, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> Memory used query method for iOS.
>> 
>> https://stackoverflow.com/a/57315975/1058199
>> 
>> //  Created by Alex Zavatone on 8/1/19.
>> //
>> 
>> class Memory: NSObject {
>> 
>>   // From Quinn the Eskimo at Apple.
>>   // https://forums.developer.apple.com/thread/105088#357415
>> 
>>   class func memoryFootprint() -> Float? {
>>   // The `TASK_VM_INFO_COUNT` and `TASK_VM_INFO_REV1_COUNT` macros are 
>> too
>>   // complex for the Swift C importer, so we have to define them 
>> ourselves.
>>   let TASK_VM_INFO_COUNT = 
>> mach_msg_type_number_t(MemoryLayout.size / 
>> MemoryLayout.size)
>>   let TASK_VM_INFO_REV1_COUNT = 
>> mach_msg_type_number_t(MemoryLayout.offset(of: 
>> \task_vm_info_data_t.min_address)! / MemoryLayout.size)
>>   var info = task_vm_info_data_t()
>>   var count = TASK_VM_INFO_COUNT
>>   let kr = withUnsafeMutablePointer(to: ) { infoPtr in
>>   infoPtr.withMemoryRebound(to: integer_t.self, capacity: 
>> Int(count)) { intPtr in
>>   task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), 
>> intPtr, )
>>   }
>>   }
>>   guard
>>   kr == KERN_SUCCESS,
>>   count >= TASK_VM_INFO_REV1_COUNT
>>   else { return nil }
>> 
>>   let usedBytes = Float(info.phys_footprint)
>>   return usedBytes
>>   }
>> 
>>   class func formattedMemoryFootprint() -> String
>>   {
>>   let usedBytes: UInt64? = UInt64(self.memoryFootprint() ?? 0)
>>   let usedMB = Double(usedBytes ?? 0) / 1024 / 1024
>>   let usedMBAsString: String = "\(usedMB)MB"
>>   return usedMBAsString
>>}
>> }
>> Enjoy
>> 
>> 
>> 
>>> On Apr 30, 2023, at 9:05 AM, Alex Zavatone  wrote:
>>> 
>>> Use the memory graph debugger, not Instruments.  
>>> 
>>> I also have a method published on StackOverflow that lets you check on and 
>>> print out the amount of memory used.  It is for iOS.
>>> 
>>> As for abandoned memory, that also could be the case.  An object in memory 
>>> with no pointer to it.
>>> 
>>> If you want, we could do a video meeting and I could guide you through it. 
>>> 
>>> Will reply with the memory querying function.
>>> 
>>> Cheers,
>>> Alex Zavatone
>>> 
>>> Sent from my iPhone
>>> 
>>>> On Apr 29, 2023, at 11:15 PM, Rob Petrovec via Cocoa-dev 
>>>>  wrote:
>>>> 
>>>> This sounds like Abandoned Memory, not a leak.  Abandoned memory is a 
>>>> retain cycle somewhere.  Best/easiest way to find those is with a 
>>>> memgraph.  Click the little sideways V icon in Xcode’s debugger when the 
>>>> problem is reproducing.
>>>> 
>>>> 
>>>> 
>>>> Or run ‘leaks MyApp --outputGraph ~’ in Terminal when the problem is 
>>>> reproducing and open the resulting .memgraph file in your home directory.  
>>>> Bonus points is enabling MallocStackLogging in the Xcode Project -> Edit 
>>>> Scheme -> Run -> Diagnostics and check Malloc Stack Logging and switch to 
>>>> All Allocations And Free History. This will show backtraces for where an 
>>>> object is created in the memgraph and other useful info.
>>>> 
>>>> Leaks show up as little yellow caution signs and abandoned memory 
>>>> sometimes have purple caution signs. Either way, look for an abnormally 
>>>> high number of objects and see if they point back to your image.  Thats 
>>>> likely where your memory is being consumed.
>>>> 
>>>>> CGImageSourceCreateWithURL() for loading, CALayer for displaying.
>>>> Just a thought since you didn’t mention it: are you releasing the 
>>>> CGImageSource object too?
>>>> 
>>>> Good luck.
>>>> 
>>>> —Rob
>>>> 
>&g

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Alex Zavatone via Cocoa-dev
Memory used query method for iOS.

https://stackoverflow.com/a/57315975/1058199

//  Created by Alex Zavatone on 8/1/19.
//

class Memory: NSObject {

// From Quinn the Eskimo at Apple.
// https://forums.developer.apple.com/thread/105088#357415

class func memoryFootprint() -> Float? {
// The `TASK_VM_INFO_COUNT` and `TASK_VM_INFO_REV1_COUNT` macros are too
// complex for the Swift C importer, so we have to define them 
ourselves.
let TASK_VM_INFO_COUNT = 
mach_msg_type_number_t(MemoryLayout.size / 
MemoryLayout.size)
let TASK_VM_INFO_REV1_COUNT = 
mach_msg_type_number_t(MemoryLayout.offset(of: 
\task_vm_info_data_t.min_address)! / MemoryLayout.size)
var info = task_vm_info_data_t()
var count = TASK_VM_INFO_COUNT
let kr = withUnsafeMutablePointer(to: ) { infoPtr in
infoPtr.withMemoryRebound(to: integer_t.self, capacity: Int(count)) 
{ intPtr in
task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), intPtr, 
)
}
}
guard
kr == KERN_SUCCESS,
count >= TASK_VM_INFO_REV1_COUNT
else { return nil }

let usedBytes = Float(info.phys_footprint)
return usedBytes
}

class func formattedMemoryFootprint() -> String
{
let usedBytes: UInt64? = UInt64(self.memoryFootprint() ?? 0)
let usedMB = Double(usedBytes ?? 0) / 1024 / 1024
let usedMBAsString: String = "\(usedMB)MB"
return usedMBAsString
 }
}
Enjoy



> On Apr 30, 2023, at 9:05 AM, Alex Zavatone  wrote:
> 
> Use the memory graph debugger, not Instruments.  
> 
> I also have a method published on StackOverflow that lets you check on and 
> print out the amount of memory used.  It is for iOS.
> 
> As for abandoned memory, that also could be the case.  An object in memory 
> with no pointer to it.
> 
> If you want, we could do a video meeting and I could guide you through it. 
> 
> Will reply with the memory querying function.
> 
> Cheers,
> Alex Zavatone
> 
> Sent from my iPhone
> 
>> On Apr 29, 2023, at 11:15 PM, Rob Petrovec via Cocoa-dev 
>>  wrote:
>> 
>> This sounds like Abandoned Memory, not a leak.  Abandoned memory is a 
>> retain cycle somewhere.  Best/easiest way to find those is with a memgraph.  
>> Click the little sideways V icon in Xcode’s debugger when the problem is 
>> reproducing.
>> 
>> 
>> 
>> Or run ‘leaks MyApp --outputGraph ~’ in Terminal when the problem is 
>> reproducing and open the resulting .memgraph file in your home directory.  
>> Bonus points is enabling MallocStackLogging in the Xcode Project -> Edit 
>> Scheme -> Run -> Diagnostics and check Malloc Stack Logging and switch to 
>> All Allocations And Free History. This will show backtraces for where an 
>> object is created in the memgraph and other useful info.
>> 
>> Leaks show up as little yellow caution signs and abandoned memory sometimes 
>> have purple caution signs. Either way, look for an abnormally high number of 
>> objects and see if they point back to your image.  Thats likely where your 
>> memory is being consumed.
>> 
>>> CGImageSourceCreateWithURL() for loading, CALayer for displaying.
>>   Just a thought since you didn’t mention it: are you releasing the 
>> CGImageSource object too?
>> 
>> Good luck.
>> 
>> —Rob
>> 
>> 
>>> On Apr 29, 2023, at 4:07 PM, Gabriel Zachmann via Cocoa-dev 
>>>  wrote:
>>> 
>>> 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 m

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Alex Zavatone via Cocoa-dev
Use the memory graph debugger, not Instruments.  

I also have a method published on StackOverflow that lets you check on and 
print out the amount of memory used.  It is for iOS.

As for abandoned memory, that also could be the case.  An object in memory with 
no pointer to it.

If you want, we could do a video meeting and I could guide you through it. 

Will reply with the memory querying function.

Cheers,
Alex Zavatone

Sent from my iPhone

> On Apr 29, 2023, at 11:15 PM, Rob Petrovec via Cocoa-dev 
>  wrote:
> 
> This sounds like Abandoned Memory, not a leak.  Abandoned memory is a retain 
> cycle somewhere.  Best/easiest way to find those is with a memgraph.  Click 
> the little sideways V icon in Xcode’s debugger when the problem is 
> reproducing.
> 
> 
> 
> Or run ‘leaks MyApp --outputGraph ~’ in Terminal when the problem is 
> reproducing and open the resulting .memgraph file in your home directory.  
> Bonus points is enabling MallocStackLogging in the Xcode Project -> Edit 
> Scheme -> Run -> Diagnostics and check Malloc Stack Logging and switch to All 
> Allocations And Free History. This will show backtraces for where an object 
> is created in the memgraph and other useful info.
> 
> Leaks show up as little yellow caution signs and abandoned memory sometimes 
> have purple caution signs. Either way, look for an abnormally high number of 
> objects and see if they point back to your image.  Thats likely where your 
> memory is being consumed.
> 
>> CGImageSourceCreateWithURL() for loading, CALayer for displaying.
>Just a thought since you didn’t mention it: are you releasing the 
> CGImageSource object too?
> 
> Good luck.
> 
> —Rob
> 
> 
>> On Apr 29, 2023, at 4:07 PM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>> 
>> 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.
>> 
>> 
>> 
>> ___
>> 
>> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: OS/X Java native bug

2023-03-19 Thread Alex Zavatone via Cocoa-dev
Would it make sense to intentionally cause this in one test case and then try 
dispatching on another queue at an intentional lower priority?  

I’m just brainstorming here to create a specific case that we know causes it, 
then examines other dispatch options at lower quality of service levels.  Am 
not even considering async yet and expect that may cause unintended 
possibilities.

My guess here is that we need this to be sync, but it cannot be on the main 
thread (obviously) so try lower QOS and another thread before looking in to a 
dispatch queue.

Just trying to look at this from the 100 ft view and exhaust the current 
options before moving pas them.

Then there is always the case of, “does anyone else have this working?  What 
are they doing and why does it work if they do?”

Cheers, 
Alex Zavatone

Sent from my iPhone

> On 19 Mar 2023, at 9:38, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> So while I am waiting for my coffee to actually start working, which 
> approaches do we think make sense here?
> 
> When starting up, check if thread == main and if so, do one thing, else do 
> the other?
> 
> If this is correct, what would each option be?
> 
> Is this an appropriate summary or a vast oversimplification?
> 
> Cheers, 
> Alex Zavatone
> 
> Sent from my iPhone
> 
>> On 17 Mar 2023, at 7:21, Michael Hall via Cocoa-dev 
>>  wrote:
>> 
>> 
>> 
>>>> On Mar 17, 2023, at 7:49 AM, Alan Snyder  wrote:
>>> 
>>> block() means invoke the block
>>> 
>>>>> On Mar 17, 2023, at 5:34 AM, Michael Hall via Cocoa-dev 
>>>>>  wrote:
>>>> 
>>>> 
>>>> 
>>>>> On Mar 17, 2023, at 6:51 AM, Michael Hall  wrote:
>>>>> 
>>>>>> 
>>>>> 
>>>>> Sorry, I looked at your link and am still not sure this is correct if you 
>>>>> are already on the main thread.
>>>>> 
>>>> 
>> 
>> Alan,
>> 
>> Sorry for not believing you the first time.
>> 
>> Semantics. Not what I usually think of with ‘block’. 
>> 
>> Sort of a difficult thing to pin down.  What I first saw after the hang 
>> running a Panama early access for the jdk…
>> 
>> "AWT-EventQueue-0" #14 prio=6 os_prio=31 cpu=16.71ms elapsed=5.56s 
>> tid=0x7f7fdc833400 nid=26883 runnable  [0x73baf000]
>>  java.lang.Thread.State: RUNNABLE
>>   at 
>> sun.java2d.opengl.CGLGraphicsConfig.getCGLConfigInfo(java.desktop@19-panama/Native
>>  Method)
>>   at 
>> sun.java2d.opengl.CGLGraphicsConfig.getConfig(java.desktop@19-panama/CGLGraphicsConfig.java:137)
>>   at 
>> sun.awt.CGraphicsDevice.(java.desktop@19-panama/CGraphicsDevice.java:99)
>>   at 
>> sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19-panama/CGraphicsEnvironment.java:169)
>>   - locked <0x00070fc0f658> (a sun.awt.CGraphicsEnvironment)
>> 
>> I went to a current jdk 19 to maven build some of Martin’s project last 
>> night which still hangs but shows…
>> 
>> "AWT-EventQueue-0" #21 [27907] prio=6 os_prio=31 cpu=13.40ms elapsed=3.81s 
>> tid=0x7fdb3785de00 nid=27907 runnable  [0x717f5000]
>>  java.lang.Thread.State: RUNNABLE
>>   at 
>> sun.java2d.metal.MTLGraphicsConfig.tryLoadMetalLibrary(java.desktop@19.0.2/Native
>>  Method)
>>   at 
>> sun.java2d.metal.MTLGraphicsConfig.getConfig(java.desktop@19.0.2/MTLGraphicsConfig.java:140)
>>   at 
>> sun.awt.CGraphicsDevice.(java.desktop@19.0.2/CGraphicsDevice.java:78)
>>   at 
>> sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19.0.2/CGraphicsEnvironment.java:169)
>>   - locked <0x00070fcf11d8> (a sun.awt.CGraphicsEnvironment)
>> 
>> Different path same result.
>> ___
>> 
>> 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/zav%40mac.com
>> 
>> This email sent to z...@mac.com
___

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

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

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

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


Re: OS/X Java native bug

2023-03-19 Thread Alex Zavatone via Cocoa-dev
So while I am waiting for my coffee to actually start working, which approaches 
do we think make sense here?

When starting up, check if thread == main and if so, do one thing, else do the 
other?

If this is correct, what would each option be?

Is this an appropriate summary or a vast oversimplification?

Cheers, 
Alex Zavatone

Sent from my iPhone

> On 17 Mar 2023, at 7:21, Michael Hall via Cocoa-dev 
>  wrote:
> 
> 
> 
>> On Mar 17, 2023, at 7:49 AM, Alan Snyder  wrote:
>> 
>> block() means invoke the block
>> 
>>>> On Mar 17, 2023, at 5:34 AM, Michael Hall via Cocoa-dev 
>>>>  wrote:
>>> 
>>> 
>>> 
>>>> On Mar 17, 2023, at 6:51 AM, Michael Hall  wrote:
>>>> 
>>>>> 
>>>> 
>>>> Sorry, I looked at your link and am still not sure this is correct if you 
>>>> are already on the main thread.
>>>> 
>>> 
> 
> Alan,
> 
> Sorry for not believing you the first time.
> 
> Semantics. Not what I usually think of with ‘block’. 
> 
> Sort of a difficult thing to pin down.  What I first saw after the hang 
> running a Panama early access for the jdk…
> 
> "AWT-EventQueue-0" #14 prio=6 os_prio=31 cpu=16.71ms elapsed=5.56s 
> tid=0x7f7fdc833400 nid=26883 runnable  [0x73baf000]
>   java.lang.Thread.State: RUNNABLE
>at 
> sun.java2d.opengl.CGLGraphicsConfig.getCGLConfigInfo(java.desktop@19-panama/Native
>  Method)
>at 
> sun.java2d.opengl.CGLGraphicsConfig.getConfig(java.desktop@19-panama/CGLGraphicsConfig.java:137)
>at 
> sun.awt.CGraphicsDevice.(java.desktop@19-panama/CGraphicsDevice.java:99)
>at 
> sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19-panama/CGraphicsEnvironment.java:169)
>- locked <0x00070fc0f658> (a sun.awt.CGraphicsEnvironment)
> 
> I went to a current jdk 19 to maven build some of Martin’s project last night 
> which still hangs but shows…
> 
> "AWT-EventQueue-0" #21 [27907] prio=6 os_prio=31 cpu=13.40ms elapsed=3.81s 
> tid=0x7fdb3785de00 nid=27907 runnable  [0x717f5000]
>   java.lang.Thread.State: RUNNABLE
>at 
> sun.java2d.metal.MTLGraphicsConfig.tryLoadMetalLibrary(java.desktop@19.0.2/Native
>  Method)
>at 
> sun.java2d.metal.MTLGraphicsConfig.getConfig(java.desktop@19.0.2/MTLGraphicsConfig.java:140)
>at 
> sun.awt.CGraphicsDevice.(java.desktop@19.0.2/CGraphicsDevice.java:78)
>at 
> sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19.0.2/CGraphicsEnvironment.java:169)
>- locked <0x00070fcf11d8> (a sun.awt.CGraphicsEnvironment)
> 
> Different path same result.
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: Retrieving the EXIF date/time from 250k images

2023-01-07 Thread Alex Zavatone via Cocoa-dev
Hi Gabe.  I’d add basic logging  before you start each image and after you 
complete each image to see how much each is taking on each of problem tests so 
you can see the extent of how slow it is on your problem platforms.

Then you can add more logging to expose the problems and start to address them 
once you see where the bottlenecks are.

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.

Cheers,
Alex Zavatone

> On Jan 7, 2023, at 12:36 PM, Gabriel Zachmann  wrote:
> 
> 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 = [

Re: setting Finder search input

2022-12-13 Thread Alex Zavatone via Cocoa-dev
This might be an actual good application of launching a compiled AppleScript or 
even an Automator action.

I seem to remember making terminal applications in Xcode.  I wonder if you 
could do that with an AS-OC script and then just call the application within 
your bundle to 

Activate the Finder
Open a new window
Press command F
Type text.

Of course, you’d need to request GUI Scripting control.

You could also just have the compiled script within your bundle and call it.  
Just compile it  using osacompile.

osacompile -o output.app input.applescript

Cheers,
Alex Zavatone

> On Dec 13, 2022, at 2:48 PM, Torsten Curdt via Cocoa-dev 
>  wrote:
> 
> Thanks for the help, Rob
> 
> Is it always going to be the same search?  If so, you could create a Saved
>> Search in the Finder and include it with your app.  Then when you want to
>> bring up the search you can open the Saved Search bundle and it will open
>> in the Finder.  Hope that helps.
>> 
> 
> I was hoping to pass it in so that search parameters are still accessible
> to the user.
> Basically the same as CMD+F and entering some search parameters.
> That would be the ideal solution.
> 
> But maybe a Saved Search could be a workaround.
> I am quite sure it would be OK if the user could see and change the
> properties of the Saved Search.
> 
> But I could not figure out how to edit a Saved Search myself yet 
> 
> Is there a way to edit a Saved Search?
> 
> cheers,
> Torsten
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: setting Finder search input

2022-12-13 Thread Alex Zavatone via Cocoa-dev
Is it reasonable to use an AppleScript to do it?

Back in the olden days, I used AS-OC to automate Illustrator, Photoshop, the 
Finder, TextEdit and ImageOptim all in one compiled application.
 
AS-OC is AppleScript-Objective-C

Cheers,
Alex Zavatone

> On Dec 13, 2022, at 2:22 PM, Rob Petrovec via Cocoa-dev 
>  wrote:
> 
> Is it always going to be the same search?  If so, you could create a Saved 
> Search in the Finder and include it with your app.  Then when you want to 
> bring up the search you can open the Saved Search bundle and it will open in 
> the Finder.  Hope that helps.
> 
> —Rob
> 
> 
>> On Dec 13, 2022, at 1:10 PM, Torsten Curdt via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I would like to open a Finder window with a pre-filled search filter and
>> search results - but I just cannot find a good way to do it. I tried to
>> find a way through the Scripting Bridge but it seems like this is not
>> exposed at all.
>> 
>> Any other suggestions?
>> 
>> cheers,
>> Torsten
>> ___
>> 
>> 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 
>> <https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com>
>> 
>> This email sent to petr...@mac.com <mailto:petr...@mac.com>
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto: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 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com>
> 
> This email sent to z...@mac.com <mailto:z...@mac.com>
___

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

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

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

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


Re: Set focus on NSTextField in an NSMenuItem

2022-10-18 Thread Alex Zavatone via Cocoa-dev
I am speaking from an iOS perspective but, is there something like 
makeFirstResponder?

Sent from my iPhone

> On Oct 18, 2022, at 6:44 PM, Dragan Milić via Cocoa-dev 
>  wrote:
> 
> Hi all,
> 
> I’m developing a tiny application, which has an NSStatusItem instance with a 
> menu. One for the menu items of the menu has a custom view, which is either 
> an NSTextField instance, or in can even be an NSView instance containing the 
> NSTextField instance (the latter approach enables me to add some borders 
> around the text field). However, I have  problems setting focus on that text 
> field. Clicking the text field does nothing and if I click on it repeatedly a 
> couple of times, the application hangs (and eventually crashes), getting into 
> the infinite loop of -[NSMenuWindowManagerWindow setFirstResponder:] 
> messages, even stealing keyboard events from all other applications while 
> hanging!
> 
> In essence, I can’t set focus on the text field nor type anything into it. I 
> had this problem on older versions of macOS (Catalina and older), but after 
> clicking on the text field a couple of times, it would get the focus 
> eventually. On Big Sur and later, it’s not possible, and clicking on the text 
> field repeatedly hangs and crashes the application.
> 
> This issue isn’t related to the menu being attached to the NSStatusItem, it 
> also happens in the main and/or contextual menu within the application. I’d 
> eventually want to set the focus on the text field programmatically each time 
> the menu appears (so a user can start typing immediately, something like 
> Spotlight used to do in the older versions of macOS), but that’s not possible 
> either.
> 
> The only similar attempt I could find is dated back in 2008 on this very 
> list, you can find it here:
> 
> https://lists.apple.com/archives/cocoa-dev/2008/Jan/msg00138.html
> 
> But even at that time, the problem was hard to solve.
> 
> I know NSMenu has its own track of the event loop and I assume that’s what 
> causes the problem. Action-On-Click oriented controls (NSButton, 
> NSPopUpButton…) work fine embedded in an NSMenuItem instance, but not 
> NSTextField. I wonder if what I want to achieve is even possible. If so, I’d 
> really appreciate if someone can offer the solution or point me in the right 
> direction for further investigation and solution attempts.
> 
> Cheers,
> -- Dragan
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: Retrieving the EXIF date/time from 250k images

2022-08-18 Thread Alex Zavatone via Cocoa-dev


> On Aug 18, 2022, at 6:47 AM, Mike Abdullah via Cocoa-dev 
>  wrote:
> 
> It’s not a very good fit, but when you say a “GCD concurrent queue”, you’d 
> need to be more specific. There are several configs possible. Do you mean a 
> global queue, or one you made yourself? If you made it yourself, how did you 
> configure it?
> 

That was ~14 years ago.  I’m just sharing what I remember.  In my case, we 
wanted the threads to read and then perform actions on the images.

Of course, reading images from media will be I/O bound from the device they’re 
being read from.  

Cheers,
Alex Zavatone
___

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-17 Thread Alex Zavatone via Cocoa-dev
Hi Jim.  You did exactly what I did.  You found the level of diminishing 
returns on threads.  

Back in 2008, while working on FiOS TV for Verizon I wrote the design to 
development automation pipeline that automated export of graphic assets from 
Illustrator, Photoshop and ImageOptim by Kornel Lesińsk.  It written in 
AppleScript (kill me now) wrapped in AppleScript-Obj-C in Xcode 3.x IIRC.  In 
spawning processes for image optimization, I tried the “make a thread for each 
image” and quickly ran into what you did.

BUT, if they were spawned, suspended and then added to an operation queue, you 
can let the operation queue to the heavy lifting.  Just as you mentioned.

One issue you could have run in to is if the media you were performing the 
writes to took longer than the amount of time to perform the image processing, 
creating a write bottleneck.

Thanks for posting the processInfo.processorCount.  That’s what I was thinking 
about but couldn’t remember.  


FYI, ImageOptim is a fun tool for smallifying images in both lossless and lossy 
operation.  It’s got one special trick I discovered added to it to get extra 
smallification.  In the images I tested, we went from ~ 18% smaller to 24 and 
then 28% smaller using my technique that’s wrapped into ImageOptim, which uses 
multiple tools and multiple parameter iterations and compares the image sizes 
to pick the smallest.  Then it wraps that with my technique until no more 
smallification can be achieved.  It’s fun.  It’s free.  And Kornel is a great 
guy for making this available if this matters to you.   Here’s the link.
https://imageoptim.com/mac

Cheers,
Alex Zavatone

> On Aug 17, 2022, at 1:32 PM, James Crate via Cocoa-dev 
>  wrote:
> 
> I have an app that does some image processing, and when I tried to use GCD it 
> created several hundred threads which didn’t work very well. NSOperationQueue 
> allows you to set the max concurrent operations, and the batch exporting 
> process fully utilizes all logical cores on the CPU.
> 
> opsQueue.maxConcurrentOperationCount = 
> NSProcessInfo.processInfo.processorCount;
> 
> Maybe I was using GCD wrong, or maybe reading, processing, and writing 
> several hundred images is not a good fit for GCD concurrent queue? In any 
> case NSOperationQueue is easy to use and works well.
> 
> Jim Crate
> 
> 
>> On Aug 16, 2022, at 3:37 PM, Jack Brindle via Cocoa-dev 
>>  wrote:
>> 
>> Instead of using NSOperationQueue, I would use GCD to handle the tasks. 
>> Create a new Concurrent queue 
>> (dispatch_queue_create(DISPATCH_QUEUE_CONCURRENT)), then enqueue the 
>> individual items to the queue for processing (dispatch_async(), using the 
>> queue created above). Everything can be handled in blocks, including the 
>> completion routines. As Christian says the problem then is that data may not 
>> be in the original order so you will probably want to sort the returned 
>> objects when done. This should significantly speed up the time to do the 
>> whole task.
>> 
>> Jack
>> 
>> 
>>> On Aug 16, 2022, at 12:26 PM, Steve Christensen via Cocoa-dev 
>>>  wrote:
>>> 
>>> You mentioned creating and managing threads on your own, but that’s what 
>>> NSOperationQueue —and the lower-level DispatchQueue— does. It also will be 
>>> more efficient with thread management since it has an intimate 
>>> understanding of the capabilities of the processor, etc., and will work to 
>>> do the “right thing” on a per-device basis.
>>> 
>>> By leveraging NSOperationQueue and then keeping each of the queue 
>>> operations focused on a single file then you’re not complicating the 
>>> management of what to do next since most of that is handled for you. Let 
>>> NSManagedObjectQueue do the heavy lifting (scheduling work) and focus on 
>>> your part of the task (performing the work).
>>> 
>>> Steve
>>> 
>>>> On Aug 16, 2022, at 8:41 AM, Gabriel Zachmann  
>>>> wrote:
>>>> 
>>>> 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
>>&

Re: Retrieving the EXIF date/time from 250k images

2022-08-16 Thread Alex Zavatone via Cocoa-dev
I love experimenting with processes like this.  Create as many operation 
processes as you have cores on your box and run a few tests to see how quickly 
the operations complete.  Try it with  2x the number of cores, 1x the number of 
cores, 1/2 x the number of cores and the number of cores + 1 and the number of 
cores - 1 to see if there are any substantial differences in time to completion.

But as the others have said, GCD and NSOperationQueue were made for these 
things.  If you’re actually trying to get work done and not researching for 
your own benefit, those are the ones to use.  They do all the heavy lifting for 
you are are easy to implement.

Cheers.
Alex Zavatone

> On Aug 16, 2022, at 2:37 PM, Jack Brindle via Cocoa-dev 
>  wrote:
> 
> Instead of using NSOperationQueue, I would use GCD to handle the tasks. 
> Create a new Concurrent queue 
> (dispatch_queue_create(DISPATCH_QUEUE_CONCURRENT)), then enqueue the 
> individual items to the queue for processing (dispatch_async(), using the 
> queue created above). Everything can be handled in blocks, including the 
> completion routines. As Christian says the problem then is that data may not 
> be in the original order so you will probably want to sort the returned 
> objects when done. This should significantly speed up the time to do the 
> whole task.
> 
> Jack
> 
> 
>> On Aug 16, 2022, at 12:26 PM, Steve Christensen via Cocoa-dev 
>>  wrote:
>> 
>> You mentioned creating and managing threads on your own, but that’s what 
>> NSOperationQueue —and the lower-level DispatchQueue— does. It also will be 
>> more efficient with thread management since it has an intimate understanding 
>> of the capabilities of the processor, etc., and will work to do the “right 
>> thing” on a per-device basis.
>> 
>> By leveraging NSOperationQueue and then keeping each of the queue operations 
>> focused on a single file then you’re not complicating the management of what 
>> to do next since most of that is handled for you. Let NSManagedObjectQueue 
>> do the heavy lifting (scheduling work) and focus on your part of the task 
>> (performing the work).
>> 
>> Steve
>> 
>>> On Aug 16, 2022, at 8:41 AM, Gabriel Zachmann  wrote:
>>> 
>>> 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
>> 
>> ___
>> 
>> 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/jackbrindle%40me.com
>> 
>> This email sent to jackbrin...@me.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Mystery interference with AirPlay

2022-06-17 Thread Alex Zavatone via Cocoa-dev
Hi.  I was able to test this yesterday and while streaming from my 2012 MacBook 
to my Apple TV, and launching Gabriel’s app, there was no interruption in 
airplay streaming.

Nice little app. 

Cheers,
Alex Zavatone

> On Jun 16, 2022, at 10:06 AM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> I’ll email you offline with a screenshot from my phone.
> 
>> On Jun 16, 2022, at 8:57 AM, Gabriel Zachmann  wrote:
>> 
>> 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
>> 
>> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Mystery interference with AirPlay

2022-06-16 Thread Alex Zavatone via Cocoa-dev
I’ll email you offline with a screenshot from my phone.

> On Jun 16, 2022, at 8:57 AM, Gabriel Zachmann  wrote:
> 
> 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
> 
> 

___

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 Alex Zavatone via Cocoa-dev


> On Jun 16, 2022, at 3:29 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
>> 
>> 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

Yes, we know.  But it’s still thinking that somehow, you are.  That’s whet 
we’re trying to point out.

What I requested is to use some source to airplay TO your Mac and then launch 
your app to replicate the issue your user is facing, 

Then once you reproduced it, start reducing functionality until it starts 
working.

Alex Zavatone
___

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 Alex Zavatone via Cocoa-dev
What we’re saying, Gabe is that something you are doing in your app is causing 
this.  

The first step is to reproduce this on your own Mac.  Try playing a song from 
your iPhone or iPad to your computer and then launch your app.

Here’s a way to do it.

How to AirPlay Video From iOS to Mac
Make sure your Mac is powered on and you're signed into macOS using the same 
Apple account as your iOS device.
Start playing a video on your ‌iPhone‌ or ‌iPad‌.
Tap the AirPlay icon in the app's media interface.
Select your Mac from the list of ‌AirPlay‌ devices.

Some of my Macs support this and some don’t.  My 27” iMac does, my 2015 MBP 
doesn’t.  I think that’s what you mean by “my Mac doesn’t have Airplay.”

You’ll need to find a way to replicate it and then start turning off 
functionality and see when it stops.

Good luck.

Alex Zavatone



> On Jun 16, 2022, at 3:29 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
>> 
>> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Mystery interference with AirPlay

2022-06-15 Thread Alex Zavatone via Cocoa-dev
My guess is that your app is playing sound which will stop any currently 
playnig airplay audio.

If that is the case, I’m not sure if there is an in app setting to not 
interrupt airplay audio.

Alex Zavatone



> On Jun 15, 2022, at 3:44 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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.
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


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

2022-04-04 Thread Alex Zavatone via Cocoa-dev
Odd that after sending that, I got an unsubscribe request from 71.231.150.21 
which is in Seattle.

Do other people get these?

Thanks,
Alex Zavatone

> On Apr 4, 2022, at 2:53 PM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> Some disassemblers I’ve used are Hopper and there is also IDA. 
> 
> Just in case you need a spare.  
> 
> Cheers,
> Alex Zavatone 
> 
>> On Apr 4, 2022, at 11:03 AM, Michal L. Wright via Cocoa-dev 
>>  wrote:
>> 
>> On Apr 4, 2022, at 08:45 , Richard Charles  wrote:
>>> 
>>> 
>>>> On Apr 4, 2022, at 8:58 AM, Michal L. Wright via Cocoa-dev 
>>>>  wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> I have a rather large Objective C project that I'm building in Xcode 13.3, 
>>>> running under macOS 12.3. 
>>>> (98 .m files with matching .h files, and a dozen or so .h files containing 
>>>> defines, with the release version of the app itself being 13.8 MB.)
>>> 
>>> My app is also large Objective C project with 247 primary source files with 
>>> the release version at 24.6 MB. Also using Xcode 13.3 running under macOS 
>>> 12.3.
>>> 
>>> 
>>>> When I run the app in Xcode (whether in debug mode or not), the All Output 
>>>> window produces the following:
>>>> 
>>>> 2022-04-02 10:11:07.626094-0700 iData Pro 5.0.00[73856:2163752] 
>>>> [logging-persist] cannot open file at line 45530 of [9ff244ce07]
>>> 
>>> I was getting output like this several weeks ago but now it has stopped. 
>>> Not sure why. My app uses CoreData but not a sandbox.
>>> 
>>> https://stackoverflow.com/questions/56461441/sqlite3-open-cannot-open-file-at-line
>>> 
>>> 
>>>> 2022-04-02 10:11:07.626135-0700 iData Pro 5.0.00[73856:2163752] 
>>>> [logging-persist] os_unix.c:45530: (0) open(/var/db/DetachedSignatures) - 
>>>> Undefined error: 0
>>> 
>>> I was getting output like this several weeks ago. The file did not exist on 
>>> my system. So I created one and never saw the message again.
>>> 
>>> touch /var/db/DetachedSignatures
>>> 
>>> https://developer.apple.com/forums/thread/131498
>>> 
>>> 
>>> Richard
>> 
>> Thanks, Richard. I'll see what I can come up with.
>> 
>> -- Mike
>> ___
>> 
>> 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/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


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

2022-04-04 Thread Alex Zavatone via Cocoa-dev
Some disassemblers I’ve used are Hopper and there is also IDA. 

Just in case you need a spare.  

Cheers,
Alex Zavatone 

> On Apr 4, 2022, at 11:03 AM, Michal L. Wright via Cocoa-dev 
>  wrote:
> 
> On Apr 4, 2022, at 08:45 , Richard Charles  wrote:
>> 
>> 
>>> On Apr 4, 2022, at 8:58 AM, Michal L. Wright via Cocoa-dev 
>>>  wrote:
>>> 
>>> Hi,
>>> 
>>> I have a rather large Objective C project that I'm building in Xcode 13.3, 
>>> running under macOS 12.3. 
>>> (98 .m files with matching .h files, and a dozen or so .h files containing 
>>> defines, with the release version of the app itself being 13.8 MB.)
>> 
>> My app is also large Objective C project with 247 primary source files with 
>> the release version at 24.6 MB. Also using Xcode 13.3 running under macOS 
>> 12.3.
>> 
>> 
>>> When I run the app in Xcode (whether in debug mode or not), the All Output 
>>> window produces the following:
>>> 
>>> 2022-04-02 10:11:07.626094-0700 iData Pro 5.0.00[73856:2163752] 
>>> [logging-persist] cannot open file at line 45530 of [9ff244ce07]
>> 
>> I was getting output like this several weeks ago but now it has stopped. Not 
>> sure why. My app uses CoreData but not a sandbox.
>> 
>> https://stackoverflow.com/questions/56461441/sqlite3-open-cannot-open-file-at-line
>> 
>> 
>>> 2022-04-02 10:11:07.626135-0700 iData Pro 5.0.00[73856:2163752] 
>>> [logging-persist] os_unix.c:45530: (0) open(/var/db/DetachedSignatures) - 
>>> Undefined error: 0
>> 
>> I was getting output like this several weeks ago. The file did not exist on 
>> my system. So I created one and never saw the message again.
>> 
>> touch /var/db/DetachedSignatures
>> 
>> https://developer.apple.com/forums/thread/131498
>> 
>> 
>> Richard
> 
> Thanks, Richard. I'll see what I can come up with.
> 
> -- Mike
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Objective-C selector names in disassembly

2022-04-03 Thread Alex Zavatone via Cocoa-dev
Yes.  Are you disassembling a release version or a debug version?

> On Apr 3, 2022, at 2:36 PM, Martin Wierschin via Cocoa-dev 
>  wrote:
> 
> Hi everyone,
> 
> I have a question that's been an irritating me for a long time. Is there any 
> way to get Xcode (or other tools) to show Objective-C selector names in 
> disassembled framework's code?
> 
> Back in the good old days viewing assembly for any Obj-C method in Xcode 
> would automatically give you this information. Xcode would always show you 
> each selector's name (as a C string) alongside the SEL value in the assembly 
> listing, usually right before each call to objc_msgSend. This was incredibly 
> useful when you had to workaround Apple bugs, or just to poke around to see 
> how things were implemented.
> 
> I forget when this changed. I know it was triggered by optimizations to the 
> Obj-C runtime. But not being able to see selector names is like being 
> blindfolded. Is there a good way to discover this information in the modern 
> runtime / toolchains?
> 
> Thanks for any tips!
> 
> ~Martin Wierschin 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Lock screen ?

2022-03-27 Thread Alex Zavatone via Cocoa-dev
How about a little more than that?  Hmm?

> On Mar 27, 2022, at 1:18 PM, Mike Bellerby via Cocoa-dev 
>  wrote:
> 
> Yes it’s possible. 
> 
> Sent from my iPhone
> 
>> On 26 Mar 2022, at 12:44 pm, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>> 
>> 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
>> 
>> ___
>> 
>> 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/mike%40bellerby.com
>> 
>> This email sent to m...@bellerby.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Building for 10.12

2022-03-20 Thread Alex Zavatone via Cocoa-dev
Isn’t it as simple as setting the minimum build version to 10.12?

> On Mar 18, 2022, at 9:47 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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.
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Indexing broken for one project

2022-02-14 Thread Alex Zavatone via Cocoa-dev
In my work MacBook on Monterey 12.1, /private is read only, but /tmp still is 
writeable.  I just create a folder there as a test.

That aside, if there’s anything I’ve learned in the week or two since I’ve been 
using Xcode, it’s “don’t do what it doesn’t expect you to do”.  That includes 
to using the default location for derived data, which is 
~/Library/Developer/Xcode/DerivedData.

Just my wild assed guess & inclination.  

Cheers,
Alex Zavatone


> On Feb 14, 2022, at 7:29 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> 
>> 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
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Indexing broken for one project

2022-02-13 Thread Alex Zavatone via Cocoa-dev


> On Feb 13, 2022, at 4:09 PM, Gabriel Zachmann  wrote:
> 
> The Derived Data directory is set to /tmp (i have had that setting for years).

Oh, don’t do that. 

Glad you’ve got it fixed.
___

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 Alex Zavatone via Cocoa-dev
This seems to indicate an error somewhere in the Xcode prefs.

Try using it in that new user is aways am option.

Or copy the project back into another folder and see if the original user can 
open the project from the other folder.

Just the two guesses I have at the moment.

Cheers,
Alex Zavatone


> On Feb 13, 2022, at 3:07 PM, Gabriel Zachmann  wrote:
> 
> 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.
> 

___

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 Alex Zavatone via Cocoa-dev
Here’s an idea.  Create a new user on your Mac.  Open the project from that new 
user and see if it indexes.

It worked fine on my Mac

Good luck.

> On Feb 12, 2022, at 8:24 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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=86400 
> -fmodules-prune-after=345600 -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=deprecated-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
>  
> 

Re: Indexing broken for one project

2022-02-06 Thread Alex Zavatone via Cocoa-dev
Over several weeks, I’ve had the most annoying problem with Xcode and pods with 
the sandbox always being out of sync.  

Guess what fixed it?  Quitting and restarting Xcode.  Sometimes this product 
just reminds you of Windows 3.1.

Best of luck.

Gabriel want me to try your project out in Xcode 13?

Let me know.

Cheers,
Alex Zavatone


> On Feb 6, 2022, at 12:18 PM, Rob Petrovec via Cocoa-dev 
>  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 
>> mailto:cocoa-dev@lists.apple.com>> 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 
>> <https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com>
>> 
>> This email sent to petr...@mac.com <mailto:petr...@mac.com>
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto: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 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com>
> 
> This email sent to z...@mac.com <mailto:z...@mac.com>
___

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

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

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

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


Re: iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
Hi David.  I hate to tell you, your code doesn’t work.

The old UINavigationBar background that I’m trying to remove is still there 
when I use your code over what I stumbled across.  

Something in the code below does remove the background image.

self.navigationController!.navigationBar.isTranslucent = false
self.navigationController!.navigationBar.titleTextAttributes = 
[.foregroundColor: UIColor.white]

let navBar = self.navigationController!.navigationBar
let standardAppearance = UINavigationBarAppearance()
standardAppearance.configureWithOpaqueBackground()
standardAppearance.backgroundImage = UIImage()

navBar.standardAppearance = standardAppearance
navBar.scrollEdgeAppearance = standardAppearance

self.navigationController?.navigationBar.backgroundImage(for: .default)
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: 
.default)

Sadly, each build takes 2 minutes (thanks Swift!) even if I’m only changing 1 
line, so it’s not time effective to figure out exactly what is.

Fun times.  

Cheers,
Alex Zavatone


> On Jan 28, 2022, at 2:02 PM, David Duncan  wrote:
> 
> 
> 
>> On Jan 28, 2022, at 11:50 AM, Alex Zavatone > <mailto:z...@mac.com>> wrote:
>> 
>> Awesome.  Thank you, David.  
>> 
>> 
>> I stumbled across this too while going through Apple documentation.  What’s 
>> scary is that I have no idea why it works.
>> 
>> self.navigationController!.navigationBar.barStyle = .default
>> self.navigationController!.navigationBar.isTranslucent = false
>> self.navigationController!.navigationBar.titleTextAttributes = 
>> [.foregroundColor: UIColor.white]
>>  self.navigationController?.navigationBar.backgroundImage(for: .default)
>> navigationController?.navigationBar.setBackgroundImage(UIImage(), 
>> for: .default)
> 
> This stuff is pre-iOS 13 appearance customization. Using the new stuff will 
> disable it.
> 
>> 
>> let navBar = self.navigationController!.navigationBar
>> let standardAppearance = UINavigationBarAppearance()
>> standardAppearance.configureWithOpaqueBackground()
>> standardAppearance.backgroundImage = UIImage()
>> 
>> navBar.standardAppearance = standardAppearance
>> navBar.scrollEdgeAppearance = standardAppearance
> 
> With iOS 13 the navigation bar now has multiple appearance states. The 
> scrollEdgeAppearance is when your bar is at the edge of a scroll view (top 
> for a navigation bar, bottom for tab & toolbar). This configures the bar to 
> use the same appearance state (in this case, a solid color background, using 
> UIColor.systemBackgroundColor). In context the setting of backgroundImage 
> doesn’t do anything (it defaults to nil and empty images have identical 
> behavior).
> 
> By setting standardAppearance == scrollEdgeAppearance it in turn disables the 
> “bar becomes transparent at the top” behavior introduced for large titles in 
> iOS 13 and extended to all bar in iOS 15.
> 
>> 
>> 
>> Thanks again David.  You’re on my Christmas list.
>> 
>> Alex Zavatone
>> 
>>> On Jan 28, 2022, at 1:30 PM, David Duncan >> <mailto:david.dun...@apple.com>> wrote:
>>> 
>>> UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
>>> [appearance configureWithTransparentBackground];
>>> navigationItem.standardAppearance = appearance;
>>> 
>>> Thats the simplest per-item way to do it. This does imply you adopt the new 
>>> appearance APIs introduced in iOS 13.
>>> 
>>>> On Jan 28, 2022, at 11:03 AM, Alex Zavatone via Cocoa-dev 
>>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>>> 
>>>> Hi there.  I’m in the middle of trying to find out how the hell to remove 
>>>> a background from a UINavigationBar and it’s not easy.  You’d think that 
>>>> you could get a UInavigationBar.navigationitem.background and remove it 
>>>> from a superview or set its alpha to 0, but it’s not that easy.
>>>> 
>>>> Does anyone have any clue how to get a reference to the background once it 
>>>> has been set so that it can be set to 0 alpha or removed from the 
>>>> superview?  
>>>> 
>>>> Thanks in advance and happy Friday.  Apple sure has ways to make things 
>>>> that should be simple very obscure and extremely deifficult to handle.  
>>>> 
>>>> Cheers, 
>>>> Alex Zavatone
>>>> ___
>>>

Re: iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
Awesome.  Thank you, David.  


I stumbled across this too while going through Apple documentation.  What’s 
scary is that I have no idea why it works.

self.navigationController!.navigationBar.barStyle = .default
self.navigationController!.navigationBar.isTranslucent = false
self.navigationController!.navigationBar.titleTextAttributes = 
[.foregroundColor: UIColor.white]

let navBar = self.navigationController!.navigationBar
let standardAppearance = UINavigationBarAppearance()
standardAppearance.configureWithOpaqueBackground()
standardAppearance.backgroundImage = UIImage()

navBar.standardAppearance = standardAppearance
navBar.scrollEdgeAppearance = standardAppearance

self.navigationController?.navigationBar.backgroundImage(for: .default)
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: 
.default)

Thanks again David.  You’re on my Christmas list.

Alex Zavatone

> On Jan 28, 2022, at 1:30 PM, David Duncan  wrote:
> 
> UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
> [appearance configureWithTransparentBackground];
> navigationItem.standardAppearance = appearance;
> 
> Thats the simplest per-item way to do it. This does imply you adopt the new 
> appearance APIs introduced in iOS 13.
> 
>> On Jan 28, 2022, at 11:03 AM, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> Hi there.  I’m in the middle of trying to find out how the hell to remove a 
>> background from a UINavigationBar and it’s not easy.  You’d think that you 
>> could get a UInavigationBar.navigationitem.background and remove it from a 
>> superview or set its alpha to 0, but it’s not that easy.
>> 
>> Does anyone have any clue how to get a reference to the background once it 
>> has been set so that it can be set to 0 alpha or removed from the superview? 
>>  
>> 
>> Thanks in advance and happy Friday.  Apple sure has ways to make things that 
>> should be simple very obscure and extremely deifficult to handle.  
>> 
>> Cheers, 
>> Alex Zavatone
>> ___
>> 
>> 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/david.duncan%40apple.com
>> 
>> This email sent to david.dun...@apple.com
> 

___

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

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

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

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


iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
Hi there.  I’m in the middle of trying to find out how the hell to remove a 
background from a UINavigationBar and it’s not easy.  You’d think that you 
could get a UInavigationBar.navigationitem.background and remove it from a 
superview or set its alpha to 0, but it’s not that easy.

Does anyone have any clue how to get a reference to the background once it has 
been set so that it can be set to 0 alpha or removed from the superview?  

Thanks in advance and happy Friday.  Apple sure has ways to make things that 
should be simple very obscure and extremely deifficult to handle.  

Cheers, 
Alex Zavatone
___

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


Stupid accessibility question - Invert colors

2021-10-25 Thread Alex Zavatone via Cocoa-dev
Am I correct in assuming that aside from ignoring invert colors in Smart 
invert, that there is no way of controlling the colors that either Classic 
Invert or Smart Invert actually invert to?

Forever indebted for helpful answers.

Fun times, fun times.
- Alex Zavatone
___

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: Accessibility UIContentSizeCategory or current accessibility font setting

2021-10-18 Thread Alex Zavatone via Cocoa-dev


> On Oct 18, 2021, at 11:31 AM, David Duncan  wrote:
> 
> In general it's also preferred that you look at the traitCollection of the 
> most relevant view for this information – there are contexts for which the 
> content size category may not match the global value (and there is API on 
> UIView to restrict the overall range that you can apply as well). This also 
> means you can just use traitCollectionDidChange as your notification.

Is that issued when the program or screen first starts up?  I was using that a 
few weeks ago for other accessibility settings, but wasn’t sure if it’s issued 
when the font first appears, because there is no change.

Thanks
Alex Zavatone


___

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: Accessibility UIContentSizeCategory or current accessibility font setting

2021-10-17 Thread Alex Zavatone via Cocoa-dev
If anyone would find this cheap hack useful to check what the current 
accessibility dynamic text size is set to, here you go.

Still, I’d love to know the actual command so that I can remove this.

Cheers,
Alex Zavatone

import Foundation
import UIKit

// Use like so.
// let myString = AccessibilityTools.currentAccessibilityDynamicTypeSize()
//

class AccessibilityTools {

class func currentAccessibilityDynamicTypeSize() -> String {
let label = UILabel()
label.font = .preferredFont(forTextStyle: UIFont.TextStyle.body)
let myFontSize = label.font.pointSize

var accessibilityEnum: String = ""
switch myFontSize {
case 14:
accessibilityEnum = "UIContentSizeCategoryExtraSmall"
case 15:
accessibilityEnum = "UIContentSizeCategorySmall"
case 16:
accessibilityEnum = "UIContentSizeCategoryMedium"
case 17:
accessibilityEnum = "UIContentSizeCategoryLarge" // default
case 19:
accessibilityEnum = "UIContentSizeCategoryExtraLarge"
case 21:
accessibilityEnum = "UIContentSizeCategoryExtraExtraLarge"
case 23:
accessibilityEnum = "UIContentSizeCategoryAccessibilityMedium"
case 28:
accessibilityEnum = "UIContentSizeCategoryAccessibilityLarge"
case 33:
accessibilityEnum = "UIContentSizeCategoryAccessibilityExtraLarge"
case 40:
accessibilityEnum = 
"UIContentSizeCategoryAccessibilityExtraExtraLarge"
case 53:
accessibilityEnum = 
"UIContentSizeCategoryAccessibilityExtraExtraExtraLarge"
default:
accessibilityEnum = "UIContentSizeCategoryUnspecified"
}

return accessibilityEnum
}
}


> On Oct 17, 2021, at 1:51 PM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> We’ve got a situation where we need to check the current accessibility font 
> size enum and apply custom settings to some attributed fonts.  I’ve seen that 
> there is a way to check the current dynamic text size using SwiftUI, but I 
> haven’t seen how to do it using UIKit.
> 
> I’ve seen that UIContentSizeCategory exists, but no idea how to see what the 
> current value is.
> 
> Is anyone aware how to do this?  TIA.
> 
> Alex Zavatone
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Accessibility UIContentSizeCategory or current accessibility font setting

2021-10-17 Thread Alex Zavatone via Cocoa-dev
We’ve got a situation where we need to check the current accessibility font 
size enum and apply custom settings to some attributed fonts.  I’ve seen that 
there is a way to check the current dynamic text size using SwiftUI, but I 
haven’t seen how to do it using UIKit.

I’ve seen that UIContentSizeCategory exists, but no idea how to see what the 
current value is.

Is anyone aware how to do this?  TIA.

Alex Zavatone
___

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: Accessibility - Smart Invert and images.

2021-09-29 Thread Alex Zavatone via Cocoa-dev
Yeah, but the docs imply that it’s supposed to do this automatically.  

> On Sep 29, 2021, at 11:28 AM, Matt Jacobson  wrote:
> 
> Check out this property on UIView:
> 
> <https://developer.apple.com/documentation/uikit/uiview/2865843-accessibilityignoresinvertcolors
>  
> <https://developer.apple.com/documentation/uikit/uiview/2865843-accessibilityignoresinvertcolors>>
> 
> or this “modifier” method on SwiftUI View:
> 
> <https://developer.apple.com/documentation/swiftui/form/accessibilityignoresinvertcolors(_:)
>  
> <https://developer.apple.com/documentation/swiftui/form/accessibilityignoresinvertcolors(_:)>>
> 
> Matt
> 
>> On Sep 29, 2021, at 12:20 PM, Alex Zavatone via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> According to the docs, Smart Invert on iOS isn’t supposed to invert images 
>> of certain types.  However, it is in my app and I’ll be damned if I can find 
>> out any documentation that would indicate the the rules around what it does 
>> and what it doesn’t invert.
>> 
>> Does anyone here have any experience with this?
>> 
>> Thanks in advance.
>> Alex Zavatone
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto: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 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/mhjacobson%40me.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/mhjacobson%40me.com>
>> 
>> This email sent to mhjacob...@me.com
> 

___

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

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

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

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


Accessibility - Smart Invert and images.

2021-09-29 Thread Alex Zavatone via Cocoa-dev
According to the docs, Smart Invert on iOS isn’t supposed to invert images of 
certain types.  However, it is in my app and I’ll be damned if I can find out 
any documentation that would indicate the the rules around what it does and 
what it doesn’t invert.

Does anyone here have any experience with this?

Thanks in advance.
Alex Zavatone
___

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 Alex Zavatone via Cocoa-dev
Any chance you can create a simple case and see if it fails or succeeds?

> On Sep 27, 2021, at 9:22 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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
>> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


iOS key or command key equivalent for testing in the Simulator.

2021-09-08 Thread Alex Zavatone via Cocoa-dev
With the addition of my little grid functionality, I’d like to enable this 
within the Simulator so that if we press a key on the Mac hosting the simulator 
or maybe even have a gesture of a swipe up, to call my method to create a new 
window and render the grid into this window.  

What I’m pretty clueless on is how to globally listen for a key press in iOS 
across all screens of the app.  Does anyone have an idea how yo go about this?

Thanks in advance,
Alex Zavatone
___

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


Quick and dirty alignment grid.

2021-09-08 Thread Alex Zavatone via Cocoa-dev
Targeted for iOS, I made a quick an dirty 8x8 grid with a 4x4 subgrid to serve 
as an overlay to help in aligning items.  
There is a major thicker separator every 10 segments.  
The subgrid can have different colors.
Transparency can be adjusted.

It’s NOT the most elegant code but for an alignment tool it’s fast enough.

Here’s how you invoke it.

//self.view.addSubview(Grid())
//
// or
//
//let gridView = Grid()
//gridView.enable4x4grid = true
//gridView.detailGridColor = .yellow // .cyan, .black, .white, .red
//gridView.transparency = 0.4 // 0…1
//self.view.addSubview(gridView)

It’s easy to change to a 5x5 grid or 10x10 grid.

Here’s what it looks like.



If anyone wants, I’ll forward the class or put it up on gitHub.

Hope someone finds this useful.
Alex Zavatone
___

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: Accessing a property of a view via its controller doesn't work

2021-09-06 Thread Alex Zavatone via Cocoa-dev


> On Sep 6, 2021, at 4:03 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Mystery solved - it was, of course, a stupid bug on my part.
> 
> Just in case somebody else stumbles across this thread: I had forgotten a 
> @synthesize in the .m file.
> (Xcode emits a warning about this, but I had overlooked it, due to several 
> other warnings always being there.)
> 
> Sorry for bothering you all.
> 

Forgot an @synthesize?  We haven’t needed to do that since Xcode 4.2.  

Do you know why you needed to do that?  It seems pretty much like an edge case. 
 

Glad it’s working.  Thanks,
Alex Zavatone



> 
> 
>> On 4. Sep 2021, at 20:06, Ben Kennedy  wrote:
>> 
>> 
>>> On Sep 4, 2021, at 10:27 AM, Gabriel Zachmann via Cocoa-dev 
>>>  wrote:
>>> 
>>> I access the window of a view by two different ways, in the controller and 
>>> in the view, resp., and in the controller, I always get a nil pointer.
>>> 
>>> In my app, I have a subclass of NSView, MyView, declared like this:
>>> 
>>> @interface MyView : NSView >> CAAnimationDelegate>
>>> {
>>>  NSWindow * window_;
>>>  ...
>>> }
>>> @property (readwrite) NSWindow * window_;
>> 
>> What’s the purpose of this? NSView already has a `window` property that 
>> returns its parent window. Why not just use that?
>> 
>> -ben
>> 
>> Sent from my iPhone
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Alex Zavatone via Cocoa-dev
I don’t know why this is happening, but I’ll often populate a variable if I 
know it from another class and can’t find it from another.  By that, I mean if 
you know the window in the class that opens the preferences, get it and set it 
in the MasterViewController.   

> On Sep 4, 2021, at 12:26 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I access the window of a view by two different ways, in the controller and in 
> the view, resp., and in the controller, I always get a nil pointer.
> 
> 
> In my app, I have a subclass of NSView, MyView, declared like this:
> 
> @interface MyView : NSView  CAAnimationDelegate>
> {
>NSWindow * window_;
>...
> }
> @property (readwrite) NSWindow * window_;
> 
> 
> In one of MyView's instance methods, I save the window like this:
> 
> - (void) viewWillMoveToWindow: (NSWindow *) newWindow
> {
>window_ = newWindow;
>...
> 
> 
> Also in MyView, I have this line to interrogate the styleMask at some point 
> later during runtime:
> 
>if ( [window_ styleMask] & NSWindowStyleMaskFullScreen )
>...
> 
> This works fine, window_ has a proper value (as a pointer), and styleMask 
> returns values as expected.
> 
> 
> However, I have pretty much the same line in my MasterViewController, which 
> does not work.
> 
> 
> In the MasterViewController, I create an instance of MyView like this:
> 
> - (void) viewDidLoad
> {
>[super viewDidLoad];
>myview_ = [[MyView alloc] initWithFrame: self.view.frame isPreview: NO ];
>[self.view addSubview: myview_]; 
>...
> 
> 
> Then, in MasterViewController's showPreferences:, I have this code:
> 
> - (IBAction) showPreferences: (id) sender
> {
>if ( [myview_.window_ styleMask] & NSWindowStyleMaskFullScreen )
>   ...
> 
> 
> Here, myview_.window_  is always 0.
> 
> 
> How could that be?
> 
> Puzzled, 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Getting notification when Facetime call comes in

2021-08-24 Thread Alex Zavatone via Cocoa-dev
Why not build your own test bed for the notifications that come in and decide 
which ones you want to respond to?

Cheers,
Alex Zavatone

> On Aug 24, 2021, at 10:52 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Thanks a lot for your response!
> 
>> Not sure if that work, but at least, you should try to use the right 
>> Notification Center. 
>> NSWorkspace Notification Center is only used to broadcast NSWorkspace 
>> notifications.
> 
> I tried it , but it did not work either.
> 
>> 
>> https://developer.apple.com/documentation/avfaudio/avaudiosession/responding_to_audio_session_interruptions
> 
> The article talks only about iOS and watchOS - does it really apply to macOS?
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Best way to grey out a status item's image?

2021-08-22 Thread Alex Zavatone via Cocoa-dev
I have some old Objective-C that makes a new image that is desaturated.

You could also try tinting it with gray.

Let me try to dig up my old image utils.

Alex Zavatone

> On Aug 22, 2021, at 11:25 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> My status item uses an image as icon like this:
> 
>let itemImage = NSImage(named: "schinkel_icon")
>itemImage?.isTemplate = false
>statusBarItem_.button?.image = itemImage
> 
> I would like to make this image grey (usually it is colorful)
> in cases when the status item is paused.
> 
> What would be the best way to do that?
> Should I just replace the icon at runtime with a grayish image?
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: How to distinguish between different MS Teams statuses

2021-07-22 Thread Alex Zavatone via Cocoa-dev
It seems that it would be tough.  How can you check if it’s happening in a 
browser?
And what if I move the window to the other monitor?

> On Jul 22, 2021, at 12:45 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> My questions is quite simple:
> is it possible to determine - in my own app - whether or not there is an MS 
> Teams video call taking place at the moment?
> 
> So far, i have been checking whether or not MS Teams is running by the 
> following snippet (omitting some of the safety guards):
> 
> let mainScreen = NSScreen.main
> let options : CGWindowListOption = [.excludeDesktopElements , 
> .optionOnScreenOnly ]
> let winArray = CGWindowListCopyWindowInfo(options, kCGNullWindowID) as? [[ 
> String : Any]]   
> let win_name : String = winInfo[kCGWindowName as String] as? String
>?? winInfo[kCGWindowOwnerName as String] 
> as? String
>?? "???"
> if ( win_name == "Microsoft Teams" ) 
>increment counter for that VC Tool
> 
> This works pretty well for other kinds of VC tools, such as Zoom and Webex.
> 
> But with MS Teams, it does not quite work.
> 
> With other VC tools, there is usually two windows, the second one being 
> created only when an actual video call is occurring at the moment.
> Not so with MS Teams. It always has only one window.
> 
> The problem is that even if a video call is going on, the window's name is 
> only "Microsoft Teams".
> 
> So, I was wondering if there is any other method how I could detect whether 
> or not a video call in MS Teams is taking place.
> 
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Simplest way to produce "tick" system sound?

2021-06-11 Thread Alex Zavatone via Cocoa-dev
There are some built in sounds that I remember.  You might want want to look 
for them.  

> On Jun 11, 2021, at 8:08 AM, Mike Abdullah via Cocoa-dev 
>  wrote:
> 
> NSBeep() ?
> 
> Mike.
> 
> Sent from my iPhone
> 
>> On 11 Jun 2021, at 13:59, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>> 
>> Sorry for the stupid question:
>> what would be the easiest way to produce that "tick" system sound
>> signifying an invalid keyboard input?
>> I am talking about the new system sound under "Big Sur" (macOS 11).
>> 
>> I used to use
>> [NSSound soundNamed: @"Funk"];
>> but that does not give me the typical "tick" system sound for invalid keys 
>> under Big Sur.
>> (It's actually a sound I have never heard from the system under Big Sur.)
>> 
>> The documentation of NSSound did not give me a hint as to the new sound 
>> names.
>> It just says 
>> "One of the named system sounds provided by the Application Kit framework"
>> but I could not find the list (and I tried googling, too).
>> 
>> And what would be the best way to make the app produce the proper sound 
>> under the respective macOS version?
>> 
>> Thanks a lot in advance.
>> 
>> Gab.
>> 
>> ___
>> 
>> 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/mabdullah%40karelia.com
>> 
>> This email sent to mabdul...@karelia.com
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Multiple shadows in iOS on a view.

2021-06-10 Thread Alex Zavatone via Cocoa-dev
Does anyone have any tips for adding multiple shadows to a view or a view’s 
CGLayer on iOS in either Objectice-C or Swift?

I’ve tried creating multiple CGLayers and adding shadows to each, then 
inserting them in a view, creating multiple views and inserting the view above 
or below the current view.  Nothing works.

What seems to be happening is that when I create another CGLayer or view, there 
is no shadow added to the other CGLayer or view, but the regular view certainly 
gets a shadow.  

FYI, I’m trying to replicate Sketch style shadows in iOS and our designers have 
used multiple external shadows which is why I’m trying for multiple 
views/layers.

Thanks in advance.  
Alex Zavatone

Source:

extension (UIView)  {
func addShadowToView(
color: UIColor?,
alpha: CGFloat,
x: CGFloat,
y: CGFloat,
blur: CGFloat,
spread: CGFloat
) {
layer.masksToBounds = false
layer.shadowColor = color?.cgColor
layer.shadowOpacity = Float(alpha)
layer.shadowOffset = CGSize(width: x, height: y)
layer.shadowRadius = blur / UIScreen.main.scale
if spread == 0 {
layer.shadowPath = nil
} else {
let deltaX = spread
let shadowRect = bounds.insetBy(dx: deltaX, dy: deltaX)
layer.shadowPath = CFBridgingRetain(UIBezierPath(rect: shadowRect)) 
as! CGPath
}
}
}

extension CALayer {
func applySketchShadow (
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
masksToBounds = false
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}


And here’s how I’m trying to use it.  Box2 is a UIImageView.  It gets one 
shadow, but never more than one. :/

alpha = 0.4
x = 0
y = 8.0
blur = 10.0
spread = 10.0 // 1

box2.addShadowToView(color: color, alpha: alpha, x: x, y: y, blur: 
blur, spread: spread)

let myView1 = UIView(frame: box2.bounds)
myView1.addShadowToView(color: color, alpha: alpha, x: x, y: y, blur: 
blur, spread: spread)
box2.insertSubview(myView1, belowSubview: box2)

let myView2 = UIView(frame: box2.bounds)
myView2.addShadowToView(color: color, alpha: alpha, x: x, y: y, blur: 
blur, spread: spread)
box2.insertSubview(myView2, belowSubview: box2)


___

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


Does anyone have any experience with positioning items in an iOS UITabBar?

2021-06-04 Thread Alex Zavatone via Cocoa-dev
We’re trying to add extra space to the left and right of a UITabBar, but having 
no luck at all.

Have any of you messed with this?

Thanks in advance on any tips.
Alex Zavatone
___

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 you handle reading a plist if it may be an array or a dictionary?

2021-05-09 Thread Alex Zavatone via Cocoa-dev
This little write up might be a fun read.  Hey, it’s Sunday.  Why not?

> On May 9, 2021, at 4:27 PM, Sandor Szatmari  
> wrote:
> 
> Alex,
> 
>> On May 9, 2021, at 15:15, Steve Mykytyn via Cocoa-dev 
>>  wrote:
>> 
>> You're creating your own problem here.
> 
> Agreed, If you have control.  I would either make all top level objects 
> arrays, or dictionaries.  If your writing the plist and its a dict, wrap it 
> in an array, or vice versa, embed arrays in a dict with meta data keys, as 
> suggested.  Of course, if you have the flexibility to do this.  
> 
> If not, I’d create a single point of access to read the plists and have logic 
> inside to handle the non-homogeneous top level objects and return a 
> consistent data structure for consumption.
> 
> Sandor

Thanks Sandor.  What’s awesome about this list is just how many collective 
brain cells we all have with all of the experience here.  It’s probably worth a 
little explanation and the end result might actually be a little fun (did I say 
it’s fun? Because it’s fun.) example of my rumored white label approach and a 
very very lightweight example of config based app architecture that supports 
this white label thingie.

It’s actually for clients who say “we are codey” but really aren’t in the way 
that they need to be.  They are solid, they are smart.  But not as Xcode 
engineers and that’s why my crew is here.  I’m creating a standard flavor of 
two config file types that will let them use to create new apps.  They are 
really good people and have a clue, but based on my experience, I need to over 
plan to make sure things are handled predictably.

We made a little app engine that they can adjust and tweak.  Some of the apps 
are using array data structures and other are using dictionary ones because the 
main screen has different navigation methods to load data that they can click 
on.

The apps need to be able to be duplicated, republished and tweaked.  My 
architecture is to map the name of the app to the name of a folder reference 
that automatically lists all files dropped into its folder.  It will then list 
if the expected folder and file exists and if it doesn’t, it will list what’s 
there.

In the config file, this is what is read and what populates the main screen’s 
nav item and when selected, the tapped on index is what is displayed in the 
next screen.

This allows the client to 
1. Duplicate the app and rename it.
2. Add an assets catalog with the proper items in it for icons and such.
3. Add a folder within the “App Specific Assets and Data” folder that is the 
name of their new app.
4. Add a plist to the “App Specific Assets and Data” folder : the name of their 
app : appName " - config data.plist” file.
5. Populate the plist with the data for their new app.

Run the new app and it’s all brand new.

Cool?

There will be a few parse classes based on the result of the data, but at least 
now, I can still make it generic enough to load it into the app and store it 
with the help that everyone’s shared with me today.

Cheers all!

Alex Zavatone

> 
>>  If you are controlling what the
>> configuration plist is, make it a dictionary at the top level with three
>> keys and entries:
>> 
>> idString - something that confirms to you that this is one of yours
>> array - the array you want in some cases
>> dictionary - the dictionary you want in some cases.
>> 
>> Then you deserialize it, confirm it's one of yours, and branch on which of
>> the latter two keys is not null.
>> 
>> This kind of situation can arise if you are configuring multiple apps out
>> of the same code base.
>> 
>> If you're not controlling the configuration plist, just use
>> NSPropertyListSerialization as noted previously and branch on what you get.
>> ___
>> 
>> 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/admin.szatmari.net%40gmail.com
>> 
>> This email sent to admin.szatmari@gmail.com

___

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

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

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

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


Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-09 Thread Alex Zavatone via Cocoa-dev


> On May 9, 2021, at 2:15 PM, Steve Mykytyn  wrote:
> 
> You're creating your own problem here.  If you are controlling what the 
> configuration plist is, make it a dictionary at the top level with three keys 
> and entries:

Yup.  I sure am.  Creating it because I want to solve it.

It’s a flavor of my white label architecture configuration that I created when 
I rewrote SendWordNow in 2015.  The entailed moving the app into a framework 
and had a white label launcher app that read a config file based on my stuff 
from back in 1998 when I made a Director App wrapper engine and specially based 
config files.  (I need to add more meaningless buzzwords. : D )

But this needs to be a more simple case tolerant as there are several apps that 
I’m making for a client that can either start with a dictionary at the top of 
the plist or an array and I need to make it forgiving for them.



> idString - something that confirms to you that this is one of yours
> array - the array you want in some cases
> dictionary - the dictionary you want in some cases.
> 

I like this.  This can handle the next stage of security which is really going 
to make people happy.

> Then you deserialize it, confirm it's one of yours, and branch on which of 
> the latter two keys is not null.
> 
> This kind of situation can arise if you are configuring multiple apps out of 
> the same code base.
> 
> If you're not controlling the configuration plist, just use 
> NSPropertyListSerialization as noted previously and branch on what you get.

Lots of goodness here, Steve.  Thanks for giving me the reason to explain.  And 
I can’t wait to tell the client about how we can now show that we are even more 
security aware so that the sec eval team realizes that we are adding security 
check boxes that we can check off.

Very nice.  I like this a lot.  Where should I send the check?

Cheers,
Alex Zavatone
___

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 you handle reading a plist if it may be an array or a dictionary?

2021-05-09 Thread Alex Zavatone via Cocoa-dev


> On May 8, 2021, at 9:55 PM, Gerd Knops  wrote:
> 
> NSPropertyListSerialization returns an id.
> 
> From there you can do
> 
> if([object isKindOfClass:NSArray.class])
> {
>   NSArray *array=object; // Not really needed, but gives hints to the 
> compiler
>   ...
> }
> else if([object isKindOfClass:NSDitctionary.class])
> {
>   ...
> }
> ...
> 

Well, hell!  There we go.  Thanks Gerd!  That’s great!

Best,
Alex Zavatone

> 
> 
>> On May 8, 2021, at 19:32, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> Well, what I’m not sure about are how to store the results internally.  Do I 
>> declare both an NSArray and an NSDictionary and check to see which one ended 
>> up getting the proper result?
>> 
>> Is there a class of object that is a collection that is - either an array or 
>> dictionary? Of course, that’s what a collection is, but I’ve never come 
>> across needing to structure code to handle ether an array or a dictionary.
>> 
>> In the text of the article, “A property list is itself an array or 
>> dictionary that contains only NSData 
>> <https://developer.apple.com/documentation/foundation/nsdata>, NSString 
>> <https://developer.apple.com/documentation/foundation/nsstring>, NSArray 
>> <https://developer.apple.com/documentation/foundation/nsarray>, NSDictionary 
>> <https://developer.apple.com/documentation/foundation/nsdictionary>, NSDate 
>> <https://developer.apple.com/documentation/foundation/nsdate>, and NSNumber 
>> <https://developer.apple.com/documentation/foundation/nsnumber> objects.”
>> 
>> It seems like just stalling the inevitable.  
>> 
>> + (NSData <https://developer.apple.com/documentation/foundation/nsdata> 
>> *)dataWithPropertyList:(id)plist 
>> format:(NSPropertyListFormat 
>> <https://developer.apple.com/documentation/foundation/nspropertylistformat>)format
>>  
>>options:(NSPropertyListWriteOptions 
>> <https://developer.apple.com/documentation/foundation/nspropertylistwriteoptions>)opt
>>  
>>  error:(out NSError 
>> <https://developer.apple.com/documentation/foundation/nserror> * _Nullable 
>> *)error;
>> 
>> OK.  So once I get an NSData object, then I need to decode it and see if 
>> it’s an array or dictionary, which ends up being the same problem I already 
>> have.
>> 
>> So, what would be the next step after that?
>> 
>> Thanks, Ben.
>> 
>> Alex Zavatone
>> 
>> 
>>> On May 8, 2021, at 7:25 PM, Ben Kennedy  wrote:
>>> 
>>> Sounds like NSPropertyListSerialization is what you’re after.
>>> 
>>> https://developer.apple.com/documentation/foundation/nspropertylistserialization
>>>  
>>> <https://developer.apple.com/documentation/foundation/nspropertylistserialization>
>>> 
>>> b
>>> 
>>> Sent from my iPhone
>>> 
>>>> On May 8, 2021, at 5:12 PM, Alex Zavatone via Cocoa-dev 
>>>>  wrote:
>>>> 
>>>> I’m reading a configuration plist like so.
>>>> 
>>>> NSFileManager *fileManager = [NSFileManager defaultManager];
>>>>  BOOL success = [fileManager fileExistsAtPath:filePath];
>>>> 
>>>>  if (success) {
>>>> 
>>>>  _configurationDictionary = [[NSMutableDictionary 
>>>> alloc]initWithDictionary:[NSDictionary 
>>>> dictionaryWithContentsOfFile:filePath]];
>>>> 
>>>> 
>>>> 
>>>> 
>>>> In some cases, I want the plist to be a dictionary.  In others, I want it 
>>>> to be an array.
>>>> 
>>>> How would anyone recommend to make this a generic method to that could 
>>>> handle if the contents of the plist was an array or a dictionary?
>>>> 
>>>> Thanks in advance.
>>>> Alex Zavatone
>>> 
>> 
>> ___
>> 
>> 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/gerti-cocoadev%40bitart.com
>> 
>> This email sent to gerti-cocoa...@bitart.com
> 

___

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

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

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

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


Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-09 Thread Alex Zavatone via Cocoa-dev


> On May 8, 2021, at 7:42 PM, Ben Kennedy  wrote:
> 
> 
>> On 8 May 2021, at 5:32 pm, Alex Zavatone  wrote:
>> 
>> Well, what I’m not sure about are how to store the results internally.  Do I 
>> declare both an NSArray and an NSDictionary and check to see which one ended 
>> up getting the proper result?
> 
> Call -[propertyListWithData:options:format:error:], and examine what kind of 
> object it returns. Process or store it accordingly.
> 
>> Is there a class of object that is a collection that is - either an array or 
>> dictionary? Of course, that’s what a collection is, but I’ve never come 
>> across needing to structure code to handle ether an array or a dictionary.
> 
> It sounds like you might need to rethink your data model a bit.

That’s what I’m trying to do!  : D

> I mean, you could hold the object in a variable of type `id` or `AnyObject` 
> (ObjC or Swift, accordingly), but that will just create hassles for 
> consumers. What format makes the most sense for the model? Transform the 
> other one into it if needed.

That’s what I was trying to avoid.  I’d simply like to see if there is a better 
way, but it might be OK to bring it in as id, check the class and then save as 
either dictionary or array.  Once it’s read only once it’s in.  

This might be a fun case for a dict or array wrapper class for my dict or array 
plist reader thanks to your tips. 

> 
>> + (NSData *)dataWithPropertyList:(id)plist 
>> 
>> OK.  So once I get an NSData object, then I need to decode it and see if 
>> it’s an array or dictionary, which ends up being the same problem I already 
>> have.
> 
> No, you have it backwards. That method is useful if you want to create a 
> plist file out of an array, dictionary, etc. To do the opposite, use 
> propertyListWithData:….
> 

Huh? + (NSData *)dataWithPropertyList:(id)plist returns an NSData object.  
Isn’t the propertyListWithData the one that creates a property list out of 
NSData?  

Anyway, thanks man!  Good stuff.

Thanks and happy Sunday.  

Alex Zavatone.
___

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 you handle reading a plist if it may be an array or a dictionary?

2021-05-08 Thread Alex Zavatone via Cocoa-dev
Well, what I’m not sure about are how to store the results internally.  Do I 
declare both an NSArray and an NSDictionary and check to see which one ended up 
getting the proper result?

Is there a class of object that is a collection that is - either an array or 
dictionary? Of course, that’s what a collection is, but I’ve never come across 
needing to structure code to handle ether an array or a dictionary.

In the text of the article, “A property list is itself an array or dictionary 
that contains only NSData 
<https://developer.apple.com/documentation/foundation/nsdata>, NSString 
<https://developer.apple.com/documentation/foundation/nsstring>, NSArray 
<https://developer.apple.com/documentation/foundation/nsarray>, NSDictionary 
<https://developer.apple.com/documentation/foundation/nsdictionary>, NSDate 
<https://developer.apple.com/documentation/foundation/nsdate>, and NSNumber 
<https://developer.apple.com/documentation/foundation/nsnumber> objects.”

It seems like just stalling the inevitable.  

+ (NSData <https://developer.apple.com/documentation/foundation/nsdata> 
*)dataWithPropertyList:(id)plist 
  format:(NSPropertyListFormat 
<https://developer.apple.com/documentation/foundation/nspropertylistformat>)format
 
 options:(NSPropertyListWriteOptions 
<https://developer.apple.com/documentation/foundation/nspropertylistwriteoptions>)opt
 
   error:(out NSError 
<https://developer.apple.com/documentation/foundation/nserror> * _Nullable 
*)error;

OK.  So once I get an NSData object, then I need to decode it and see if it’s 
an array or dictionary, which ends up being the same problem I already have.

So, what would be the next step after that?

Thanks, Ben.

Alex Zavatone


> On May 8, 2021, at 7:25 PM, Ben Kennedy  wrote:
> 
> Sounds like NSPropertyListSerialization is what you’re after.
> 
> https://developer.apple.com/documentation/foundation/nspropertylistserialization
>  
> <https://developer.apple.com/documentation/foundation/nspropertylistserialization>
> 
> b
> 
> Sent from my iPhone
> 
>> On May 8, 2021, at 5:12 PM, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> I’m reading a configuration plist like so.
>> 
>> NSFileManager *fileManager = [NSFileManager defaultManager];
>>BOOL success = [fileManager fileExistsAtPath:filePath];
>> 
>>if (success) {
>> 
>>_configurationDictionary = [[NSMutableDictionary 
>> alloc]initWithDictionary:[NSDictionary 
>> dictionaryWithContentsOfFile:filePath]];
>> 
>> 
>> 
>> 
>> In some cases, I want the plist to be a dictionary.  In others, I want it to 
>> be an array.
>> 
>> How would anyone recommend to make this a generic method to that could 
>> handle if the contents of the plist was an array or a dictionary?
>> 
>> Thanks in advance.
>> Alex Zavatone
> 

___

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 you handle reading a plist if it may be an array or a dictionary?

2021-05-08 Thread Alex Zavatone via Cocoa-dev
I’m reading a configuration plist like so.

NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL success = [fileManager fileExistsAtPath:filePath];

if (success) {
  
_configurationDictionary = [[NSMutableDictionary 
alloc]initWithDictionary:[NSDictionary dictionaryWithContentsOfFile:filePath]];




In some cases, I want the plist to be a dictionary.  In others, I want it to be 
an array.

How would anyone recommend to make this a generic method to that could handle 
if the contents of the plist was an array or a dictionary?

Thanks in advance.
Alex Zavatone

___

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: iOS, handling communicating to a server with a "Not Trusted" SSL cert.

2021-04-22 Thread Alex Zavatone via Cocoa-dev
FYI, the workaround was the WKWebViewDelegate equivalent of responding to a 
URLConnection challenge/response.

Once that was called, check the securityref and if it’s not nil, set the proper 
trust exceptions.  If it is nil, skip that and pass nil to the callback.

The webView ends up loading the URL if there is a challenge or not.

Matt’s detail about the iOS 14 trusted cert root list piggybacks off of the iOS 
13 changes which limit SSL certs to 1 year.  These details really help narrow 
down the many reasons why the certs are no longer valid.  

Super helpful.  I thank you again.

Hopefully, this will also help out others who will run into this.

Best, and thanks again.

Alex Zavatone

> On Apr 20, 2021, at 3:32 PM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> Thanks Matt.  A world of good information in there.  
> 
> One thing that’s odd though is that we’re issuing an NSURL loadRequest to a 
> WKWebView.  I’d expect that a simple blanket NSAppTransportSecurity allow 
> arbitrary loads or an allow arbtrary loads in web content would allow the 
> invalud cert to be bypassed, but the error -1202 is still being caught and 
> the error of “The  certificate for this server is invalid” still gets caught 
> in a navigation error on the web delegate.
> 
> Any ideas?
> 
> Thanks in advance,
> Alex Zavatone 
> 
>> On Apr 18, 2021, at 11:54 AM, Matt Eaton  wrote:
>> 
>>> But I’d also like to see what’s wrong with the cert.  
>> 
>> If this a certificate that you control then I would recommend trying to take 
>> a look at how to fix your certificate rather than adding an ATS exception or 
>> overriding trust evaluation on the client side.  This would provide the best 
>> long term solution.
>> 
>> As to how to solve your problem; "Not Trusted," can stem from a variety of 
>> issues when a policy is evaluated on the client side.  HT211025 and HT210176 
>> provide an excellent outline for why a certificate can end up in this state. 
>>  A few things to check:
>> 
>> * Who is the issuer (CA) of the leaf certificate on the server side that is 
>> being evaluated? Is it an In-House CA or is it a CA that contains a root in 
>> the device's trust store? <https://support.apple.com/en-us/HT212140 
>> <https://support.apple.com/en-us/HT212140>>.  The reason why I mention this 
>> is because certificates that are issued from a CA that has a root in the 
>> trust store generally fulfill the requirements of outlined by HT211025 and 
>> HT210176.  If the leaf is issued from an In-House CA then a chain of trust 
>> may not be able to be created during trust evaluation, or one of the other 
>> requirements may not be getting fulfilled from HT211025 and HT210176 and 
>> this could be the breakdown.
>> 
>> * If the leaf comes from the CA that contains a root in the trust store then 
>> check the validity period of the certificate.  This can be done by checking 
>> the "Not Valid Before," and "Not Valid After" time stamps on the certificate 
>> to see if they fit into the requirements outline by HT211025 and HT210176.
>> 
>> * Is the certificate being trusted via an external CT (Certificate 
>> Transparency) log or an embedded SCT?  This can usually be done with a SCT 
>> (Signed Certificate Timestamp) embedded in the certificate and then the 
>> certificate can be evaluated via a TLS extension.  Other forms of validation 
>> include a client making a OCSP request to check the status of the 
>> certificate from a log operator.  These details can be confirmed by looking 
>> at a packet trace with the certificate in question.  
>> 
>> The best way to see what is wrong with the certificate in question is to 
>> check the certificate details or take a packet trace and review the 
>> information being exchanged in the client hello / server hello during the 
>> TLS handshake.  This should give you a baseline for what is happening.
>> 
>> If you need to setup test cases for these scenarios, try using BadSSL, 
>> (<https://badssl.com <https://badssl.com/>>) to test out whether you are 
>> correctly handling many of the common failures that you can run into when 
>> evaluating trust.
>> 
>> 
>>> On Apr 17, 2021, at 1:32 PM, Alex Zavatone via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> I just came across this the other day and now need to do something about 
>>> it.  Am looking to see if anyone else has had to handle this and profit off 
>>> of the wisdom of those who have suffered through it before.
>>> 
>>> Currently, I’m planning on testi

Re: iOS, handling communicating to a server with a "Not Trusted" SSL cert.

2021-04-20 Thread Alex Zavatone via Cocoa-dev
Thanks Matt.  A world of good information in there.  

One thing that’s odd though is that we’re issuing an NSURL loadRequest to a 
WKWebView.  I’d expect that a simple blanket NSAppTransportSecurity allow 
arbitrary loads or an allow arbtrary loads in web content would allow the 
invalud cert to be bypassed, but the error -1202 is still being caught and the 
error of “The  certificate for this server is invalid” still gets caught in a 
navigation error on the web delegate.

Any ideas?

Thanks in advance,
Alex Zavatone 

> On Apr 18, 2021, at 11:54 AM, Matt Eaton  wrote:
> 
>> But I’d also like to see what’s wrong with the cert.  
> 
> If this a certificate that you control then I would recommend trying to take 
> a look at how to fix your certificate rather than adding an ATS exception or 
> overriding trust evaluation on the client side.  This would provide the best 
> long term solution.
> 
> As to how to solve your problem; "Not Trusted," can stem from a variety of 
> issues when a policy is evaluated on the client side.  HT211025 and HT210176 
> provide an excellent outline for why a certificate can end up in this state.  
> A few things to check:
> 
> * Who is the issuer (CA) of the leaf certificate on the server side that is 
> being evaluated? Is it an In-House CA or is it a CA that contains a root in 
> the device's trust store? <https://support.apple.com/en-us/HT212140 
> <https://support.apple.com/en-us/HT212140>>.  The reason why I mention this 
> is because certificates that are issued from a CA that has a root in the 
> trust store generally fulfill the requirements of outlined by HT211025 and 
> HT210176.  If the leaf is issued from an In-House CA then a chain of trust 
> may not be able to be created during trust evaluation, or one of the other 
> requirements may not be getting fulfilled from HT211025 and HT210176 and this 
> could be the breakdown.
> 
> * If the leaf comes from the CA that contains a root in the trust store then 
> check the validity period of the certificate.  This can be done by checking 
> the "Not Valid Before," and "Not Valid After" time stamps on the certificate 
> to see if they fit into the requirements outline by HT211025 and HT210176.
> 
> * Is the certificate being trusted via an external CT (Certificate 
> Transparency) log or an embedded SCT?  This can usually be done with a SCT 
> (Signed Certificate Timestamp) embedded in the certificate and then the 
> certificate can be evaluated via a TLS extension.  Other forms of validation 
> include a client making a OCSP request to check the status of the certificate 
> from a log operator.  These details can be confirmed by looking at a packet 
> trace with the certificate in question.  
> 
> The best way to see what is wrong with the certificate in question is to 
> check the certificate details or take a packet trace and review the 
> information being exchanged in the client hello / server hello during the TLS 
> handshake.  This should give you a baseline for what is happening.
> 
> If you need to setup test cases for these scenarios, try using BadSSL, 
> (<https://badssl.com <https://badssl.com/>>) to test out whether you are 
> correctly handling many of the common failures that you can run into when 
> evaluating trust.
> 
> 
>> On Apr 17, 2021, at 1:32 PM, Alex Zavatone via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I just came across this the other day and now need to do something about it. 
>>  Am looking to see if anyone else has had to handle this and profit off of 
>> the wisdom of those who have suffered through it before.
>> 
>> Currently, I’m planning on testing out an NSAPPTransportSecurity exception 
>> in the plist on the offending domain.  But I’d also like to see what’s wrong 
>> with the cert.  
>> 
>> Will check out the recommendations here too.  
>> https://support.apple.com/en-us/HT210176
>> 
>> And the discussion here.  
>> https://developer.apple.com/forums/thread/655074?login=true
>> 
>> 
>> And the notice here.  https://support.apple.com/en-us/HT211025
>> 
>>  TLS server certificates issued on or after September 1, 2020 00:00 
>> GMT/UTC must not have a validity period greater than 398 days.
>> 
>>  Connections to TLS servers violating these new requirements will fail. 
>> 
>> 
>> Another question, is there a way to make sure to get these announcements 
>> from Apple in emails?  Am I the only person who is constantly surprised by 
>> these new policies?
>> 
>> Thanks in advance.
>> Alex Zavatone
>> 
>> 
>> 
>> __

iOS, handling communicating to a server with a "Not Trusted" SSL cert.

2021-04-17 Thread Alex Zavatone via Cocoa-dev
I just came across this the other day and now need to do something about it.  
Am looking to see if anyone else has had to handle this and profit off of the 
wisdom of those who have suffered through it before.

Currently, I’m planning on testing out an NSAPPTransportSecurity exception in 
the plist on the offending domain.  But I’d also like to see what’s wrong with 
the cert.  

Will check out the recommendations here too.  
https://support.apple.com/en-us/HT210176

And the discussion here.  
https://developer.apple.com/forums/thread/655074?login=true


And the notice here.  https://support.apple.com/en-us/HT211025

TLS server certificates issued on or after September 1, 2020 00:00 
GMT/UTC must not have a validity period greater than 398 days.

Connections to TLS servers violating these new requirements will fail. 


Another question, is there a way to make sure to get these announcements from 
Apple in emails?  Am I the only person who is constantly surprised by these new 
policies?

Thanks in advance.
Alex Zavatone



___

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: WKWebView rejecting keyboard input

2021-04-15 Thread Alex Zavatone via Cocoa-dev
Hi Rob. One thing that I learned back in QA is that when we have a working 
sample and one non-working one, duplicate both, point your app to use them, & 
start removing items from the one that doesn’t work until you get back down to 
either it working or end up with identical items in the working sample and it 
still doesn’t work.

Have you tried that yet?

Let us know.
Alex Zavatone

> On Apr 15, 2021, at 9:42 AM, Robert Walsh via Cocoa-dev 
>  wrote:
> 
> I have an Objective-C application that creates a WKWebView to collect form 
> input.  The form has a label, an input (password) field, and two buttons.  
> When the form is shown inside the web view by the application, the user can 
> click the buttons but cannot enter text into the input field.  The system 
> plays a sound to indicate that the key was rejected.  I've tried adding a 
> text area element to the form just to see if the problem is with the input 
> field itself, but the user cannot type in the text area either.  If I take 
> the same HTML/stylesheet content and open it in Safari, the input field 
> accepts keyboard input.
> 
> There is another area of the application that shows a different web page in 
> the same WKWebView component.  That page, too, contains a form with an input 
> field, and the user can type into that one.
> 
> I am using a WKWebView subclass so that I can trap mouse down events, but I 
> do not have any overloads for keyboard event handlers.
> 
> I'm having trouble determining where (e.g., by what component) the keys are 
> being blocked and why they are allowed on one page but not another.
> 
> Thanks!
> Rob Walsh
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Scroller and not apple's mouse

2021-04-13 Thread Alex Zavatone via Cocoa-dev
And WHICH non-Apple mice are you using?

Sent from my iPhone

> On Apr 13, 2021, at 8:44 AM, Alex Zavatone  wrote:
> 
> Please show your code.  Otherwise, we have little to go on.
> 
> Sent from my iPhone
> 
>> On Apr 13, 2021, at 2:41 AM, Allan Odgaard via Cocoa-dev 
>>  wrote:
>> 
>> Probably two things relevant here.
>> 
>> One is General in system preferences which look like this:
>> 
>> ![](cid:2C16BC1B-F302-426F-9F6A-665F55C99045@simplit.com "PastedImage.png")
>> 
>> A Magic Mouse may count as a “track pad” so if you have this setting to 
>> automatic, the scrollers will only be shown when scrolling.
>> 
>> You can manually override the scroller setting: 
>> https://developer.apple.com/documentation/appkit/nsscroller/1523591-scrollerstyle
>> 
>> The style it sounds like you prefer is NSScrollerStyleOverlay.
>> 
>> However, I would discourage you from changing this.
>> 
>> 
>>>> On 13 Apr 2021, at 9:24, IOS NACSPORT via Cocoa-dev wrote:
>>> 
>>> Hi,
>>> 
>>> I connect any non-Apple mouse, turn off the Apple mouse and the scroll 
>>> shows, in it I can´t change the background color. I used swift and macOS. 
>>> Without another mouse, only magic mouse I can change this color without 
>>> problem.
>>> 
>>> Regards
>>> 
>>>> El 12/4/21 a las 23:40, Jack Brindle escribió:
>>>> What is the mouse, and is there any installed software involved that goes 
>>>> with the mouse?
>>>> 
>>>> Jack
>>>> 
>>>> 
>>>>> On Apr 12, 2021, at 12:30 AM, IOS NACSPORT via Cocoa-dev 
>>>>>  wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I don't kown is the correct place, In a NSScroller, when I conect the 
>>>>> external mouse, not apple's mouse, the scroll change and show always, the 
>>>>> problem is that I can't change its background color. How could it? or at 
>>>>> least make it clear.
>>>>> 
>>>>> 
>>>>> Regards
>>>>> 
>>>>> ___
>>>>> 
>>>>> 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/jackbrindle%40me.com
>>>>> 
>>>>> This email sent to jackbrin...@me.com
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/lists%2Bcocoa-dev%40simplit.com
>>> 
>>> This email sent to lists+cocoa-...@simplit.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
___

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

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

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

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


Re: Scroller and not apple's mouse

2021-04-13 Thread Alex Zavatone via Cocoa-dev
Please show your code.  Otherwise, we have little to go on.

Sent from my iPhone

> On Apr 13, 2021, at 2:41 AM, Allan Odgaard via Cocoa-dev 
>  wrote:
> 
> Probably two things relevant here.
> 
> One is General in system preferences which look like this:
> 
> ![](cid:2C16BC1B-F302-426F-9F6A-665F55C99045@simplit.com "PastedImage.png")
> 
> A Magic Mouse may count as a “track pad” so if you have this setting to 
> automatic, the scrollers will only be shown when scrolling.
> 
> You can manually override the scroller setting: 
> https://developer.apple.com/documentation/appkit/nsscroller/1523591-scrollerstyle
> 
> The style it sounds like you prefer is NSScrollerStyleOverlay.
> 
> However, I would discourage you from changing this.
> 
> 
>> On 13 Apr 2021, at 9:24, IOS NACSPORT via Cocoa-dev wrote:
>> 
>> Hi,
>> 
>> I connect any non-Apple mouse, turn off the Apple mouse and the scroll 
>> shows, in it I can´t change the background color. I used swift and macOS. 
>> Without another mouse, only magic mouse I can change this color without 
>> problem.
>> 
>> Regards
>> 
>>> El 12/4/21 a las 23:40, Jack Brindle escribió:
>>> What is the mouse, and is there any installed software involved that goes 
>>> with the mouse?
>>> 
>>> Jack
>>> 
>>> 
 On Apr 12, 2021, at 12:30 AM, IOS NACSPORT via Cocoa-dev 
  wrote:
 
 Hi,
 
 I don't kown is the correct place, In a NSScroller, when I conect the 
 external mouse, not apple's mouse, the scroll change and show always, the 
 problem is that I can't change its background color. How could it? or at 
 least make it clear.
 
 
 Regards
 
 ___
 
 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/jackbrindle%40me.com
 
 This email sent to jackbrin...@me.com
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/lists%2Bcocoa-dev%40simplit.com
>> 
>> This email sent to lists+cocoa-...@simplit.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com
___

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

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

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

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


Re: Scroller and not apple's mouse

2021-04-12 Thread Alex Zavatone via Cocoa-dev
What are you trying to do?  Which platform is this for?  Which language are you 
using?

Regards,
Alex Zavatone

> On Apr 12, 2021, at 2:30 AM, IOS NACSPORT via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> I don't kown is the correct place, In a NSScroller, when I conect the 
> external mouse, not apple's mouse, the scroll change and show always, the 
> problem is that I can't change its background color. How could it? or at 
> least make it clear.
> 
> 
> Regards
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Several different NSUserDefaults in the same app?

2021-04-04 Thread Alex Zavatone via Cocoa-dev
And if you want a nice simple HMAC256 encoding class to make the results 
securer if you want, I’ll happily toss one your way.

> On Apr 4, 2021, at 2:22 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> 
>> It appears you are trying to get NSUserDefaults to do something that Apple 
>> doesn?t want it to do these days. Why not create your own defaults,
>> writing the data to a dictionary that is then written to a file that you 
>> save in the ~/Library/Preferences folder, with a name of your choice?
> 
> I can see that this would work well.
> 
> It didn't seem to me that one solution is superior to another.
> So, I have now implemented one dictionary per display that my app sees,
> and store those dictionaries in the NSUserDefaults, with the display name as 
> the key.
> 
> Thanks a lot for all your help and ideas!
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Several different NSUserDefaults in the same app?

2021-04-03 Thread Alex Zavatone via Cocoa-dev
Why not use your top level NSUserDefaults  as a dictionary and use each monitor 
name as a key for each object in the dictionary?  Is that too clunky?

https://developer.apple.com/documentation/foundation/nsuserdefaults

A default object must be a property list—that is, an instance of (or for 
collections, a combination of instances of) NSData 
<https://developer.apple.com/documentation/foundation/nsdata>, NSString 
<https://developer.apple.com/documentation/foundation/nsstring>, NSNumber 
<https://developer.apple.com/documentation/foundation/nsnumber>, NSDate 
<https://developer.apple.com/documentation/foundation/nsdate>, NSArray 
<https://developer.apple.com/documentation/foundation/nsarray>, or NSDictionary 
<https://developer.apple.com/documentation/foundation/nsdictionary>.

Am I missing something here?

Alex Zavatone

> On Apr 2, 2021, at 4:05 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I used to manage different NSUserDefaults in my app depending on which 
> monitor it runs.
> So, I create filenames of the user defaults like this:
>  NSString * defaults_name = [ NSString stringWithFormat:@"de.zach.MyApp.%@", 
> displayname ];
> 
> Then I used to create the NSUserDefaults object with an unusual approach,
> but that does not seem to work any more.
> 
> So, I am wondering, what is the correct and easy approach to managing 
> different user settings (user defaults)?
> 
> Note that my app is sandboxed, so the user defaults must go in 
>  ~/Library/Containers/de.zach.MyApp/Data/Library/Preferences/
> , must they not?
> 
> I looked at -initWithSuiteName , but it seems to me that is not they proper 
> approach, is it?
> 
> Thanks a lot in advance for all kinds of insights and help!
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Bug reporting again.

2020-11-22 Thread Alex Zavatone via Cocoa-dev


> On Nov 22, 2020, at 3:08 PM, Ben Kennedy  wrote:
> 
> 
>> On 22 Nov 2020, at 12:45 pm, Alex Zavatone via Cocoa-dev 
>>  wrote:
>> 
>> I’ve found a bug in Swift’s loadView for UIViewController on iOS that I’d 
>> like to report.  Swift.org tells us to use https://bugreport.apple.com which 
>> returns  “bugreport.apple.com’s server IP address could not be found.”.
> 
> Apple replaced Bug Reporter with Feedback Assistant months ago: 
> https://developer.apple.com/bug-reporting/
> 
> The web site you're looking for is https://feedbackassistant.apple.com.
> 
> -ben
> 

Yeah, odd.  That’s what I loaded earlier but it didn’t being up any content to 
the right of the issue pane on the left.

Aaaand of course it opens just fine now!  

Rocking, Ben.  Thanks a million +/- inflation.

Happy Sunday.
Alex Zavatone
___

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


Bug reporting again.

2020-11-22 Thread Alex Zavatone via Cocoa-dev
I’ve found a bug in Swift’s loadView for UIViewController on iOS that I’d like 
to report.  Swift.org tells us to use https://bugreport.apple.com which returns 
 “bugreport.apple.com’s server IP address could not be found.”.

Feedback.apple.com seems not related to bug reporting.  

I’ve created two projects that show expected behaviour for loadView in 
UIViewController, and how in Swift, what is indicated in the header for 
loadView is not followed.

How can I report this to Apple or the Swift team?

Essentially, what this header information is telling us is not followed in 
Swift 5.x, breaking over 13 years of precident.  Swift does not attempt to load 
an XIB that matches the name of the class being instantiated if the view is 
nil, counter to what the header file says it should do.

From  UIViewController.h

/*
  The designated initializer. If you subclass UIViewController, you must 
call the super implementation of this
  method, even if you aren't using a NIB.  (As a convenience, the default 
init method will do this for you,
  and specify nil for both of this methods arguments.) In the specified 
NIB, the File's Owner proxy should
  have its class set to your view controller subclass, with the view outlet 
connected to the main view. If you
  invoke this method with a nil nib name, then this class' -loadView method 
will attempt to load a NIB whose
  name is the same as your view controller's class. If no such NIB in fact 
exists then you must either call
  -setView: before -view is invoked, or override the -loadView method to 
set up your views programatically.
*/



The behaviour below is what is simply not happening.

If you
  invoke this method with a nil nib name, then this class' -loadView method 
will attempt to load a NIB whose
  name is the same as your view controller's class.


The easyiest way to reproduce this is to simply create a ViewController with an 
XIB and make it the initial view controller in a storyboard.  
Add a label to the XIB to make it obvious when or if the XIB loads.  
In the storyboard scene for that viewController, delete the top level view to 
create the nil condition and run the app.

In an Objective-C app on iOS, the expected XIB loads.
In a Swift app on iOS, the view is empty and no XIB loads.

This is validated in the View Debugger.

So, how can I report this?

Thanks in advance.
Alex Zavatone


___

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: Keyboard woes

2020-11-17 Thread Alex Zavatone via Cocoa-dev
I know it’s a lot to ask, but what happens if you set up a simple case?  Does 
the same thing happen?

I’ve had to do that many times from back in the Macromedia days until now to 
narrow down what’s causing the problem.  When faced with such strangeness as 
this, try to see if you can set up a simple case to reproduce it.  Then compare 
the differences between the two and narrow it down from there.



> On Nov 17, 2020, at 9:05 PM, Laurent Daudelin  
> wrote:
> 
> Xcode release 12.2, both iOS 13 and 14. Both on device and simulator. The 
> work I did on the app was trying to get the split view controller with the 
> new APIs to behave like when used with the old APIs. I finally gave up after 
> trying every possible combination of style and behavior. My app was 
> originally designed 5 years ago. There might still be stuff that is impacting 
> the new APIs, although I did search for all occurrences of the split view 
> controller and isolated the few calls I had with @available to leave the new 
> APIs do their job. But, I don’t see how this is related to all textfields and 
> textviews now being unable to work with the keyboard!
> 
> -Laurent.
> -- 
> Laurent Daudelin  
> laur...@nemesys-soft.com
> Skype: LaurentDaudelin
> Logiciels Némésys Software
> http://www.nemesys-soft.com/
> 
>> On Nov 17, 2020, at 19:51, Alex Zavatone  wrote:
>> 
>> Which version of Xcode and iOS?  Is it in a Simulator, on the device or both?
>> 
>>> On Nov 17, 2020, at 6:12 PM, Laurent Daudelin via Cocoa-dev 
>>>  wrote:
>>> 
>>> Anybody knows why, all of a sudden, when the keyboard will appear when 
>>> editing a UITextField or a UITextView, the entire screen seems to freeze? 
>>> The app in the debugger still to be still running but the interface seems 
>>> frozen. Trying to rotate doesn’t do anything. There are no errors displayed 
>>> in the console. I had text fields and text views that were working as 
>>> usual, I made some changes here and there and now, I can’t remember what I 
>>> could have done that is causing this problem. It looks like the runloop is 
>>> not working. I have one case of textfield in a tableview controller that is 
>>> presented modally like this:
>>> 
>>>  self.loginController = [APP_DELEGATE.currentStoryboard 
>>> instantiateViewControllerWithIdentifier:@"LoginTableViewController"];
>>>  self.loginController.nameTextField.text = lastAccountUsed;
>>>  self.loginController.modalPresentationStyle = 
>>> UIModalPresentationFormSheet;
>>>  [self presentViewController:self.loginController animated:YES 
>>> completion:nil];
>>> 
>>> From the login view controller:
>>> 
>>> 
>>> - (void)viewWillAppear:(BOOL)animated
>>> {
>>> [super viewWillAppear:animated];
>>>  self.nameTextField.enabled = YES;
>>> self.nameTextField.text = @"";
>>>  self.passwordTextField.enabled = YES;
>>> self.passwordTextField.text = @"";
>>> self.loginButton.enabled = NO;
>>> }
>>> 
>>> - (void)viewDidAppear:(BOOL)animated
>>> {
>>> [super viewDidAppear:animated];
>>> [self.nameTextField becomeFirstResponder];
>>> }
>>> 
>>> This has worked for a long time and now, when the same code is executed, 
>>> the interface just freezes. I have another case of a view controller that 
>>> is presented as a popover and contains a UITextView. As soon as my code 
>>> tries to set the text view as first responder, the keyboard appears, the 
>>> text insertion point shows but does not blink.
>>> 
>>> I really don’t know what I did :/
>>> 
>>> Anybody has any idea?
>>> 
>>> -Laurent.
>>> -- 
>>> Laurent Daudelin
>>> laur...@nemesys-soft.com <mailto:laur...@nemesys-soft.com>
>>> Skype: LaurentDaudelin  
>>> Logiciels Némésys Software  
>>> http://www.nemesys-soft.com/ <http://www.nemesys-soft.com/>
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> 
>>> This email sent to z...@mac.com
> 

___

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

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

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

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


Re: Keyboard woes

2020-11-17 Thread Alex Zavatone via Cocoa-dev
Which version of Xcode and iOS?  Is it in a Simulator, on the device or both?

> On Nov 17, 2020, at 6:12 PM, Laurent Daudelin via Cocoa-dev 
>  wrote:
> 
> Anybody knows why, all of a sudden, when the keyboard will appear when 
> editing a UITextField or a UITextView, the entire screen seems to freeze? The 
> app in the debugger still to be still running but the interface seems frozen. 
> Trying to rotate doesn’t do anything. There are no errors displayed in the 
> console. I had text fields and text views that were working as usual, I made 
> some changes here and there and now, I can’t remember what I could have done 
> that is causing this problem. It looks like the runloop is not working. I 
> have one case of textfield in a tableview controller that is presented 
> modally like this:
> 
>self.loginController = [APP_DELEGATE.currentStoryboard 
> instantiateViewControllerWithIdentifier:@"LoginTableViewController"];
>self.loginController.nameTextField.text = lastAccountUsed;
>self.loginController.modalPresentationStyle = 
> UIModalPresentationFormSheet;
>[self presentViewController:self.loginController animated:YES 
> completion:nil];
> 
> From the login view controller:
> 
> 
> - (void)viewWillAppear:(BOOL)animated
> {
>   [super viewWillAppear:animated];
>self.nameTextField.enabled = YES;
>   self.nameTextField.text = @"";
>self.passwordTextField.enabled = YES;
>   self.passwordTextField.text = @"";
>   self.loginButton.enabled = NO;
> }
> 
> - (void)viewDidAppear:(BOOL)animated
> {
>   [super viewDidAppear:animated];
>   [self.nameTextField becomeFirstResponder];
> }
> 
> This has worked for a long time and now, when the same code is executed, the 
> interface just freezes. I have another case of a view controller that is 
> presented as a popover and contains a UITextView. As soon as my code tries to 
> set the text view as first responder, the keyboard appears, the text 
> insertion point shows but does not blink.
> 
> I really don’t know what I did :/
> 
> Anybody has any idea?
> 
> -Laurent.
> -- 
> Laurent Daudelin  
> laur...@nemesys-soft.com 
> Skype: LaurentDaudelin
> Logiciels Némésys Software
> http://www.nemesys-soft.com/ 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Missing log output

2020-11-12 Thread Alex Zavatone via Cocoa-dev


> On Nov 12, 2020, at 12:50 PM, Gabriel Zachmann  wrote:
> 
>> 
>> Gabe, let me share the decisions and solutions I went over in my attempting 
>> to solve this on iOS.
> 
> Thanks a lot!
> 
> (BTW: I am working on macOS.)
> 
>> 
>> In my first logging, all that I wanted was to be able to get the NSLogs out 
>> of a file that ONLY had the logs from my app.  I sent you the code for that.
> 
> Thanks , that is pretty much what I would like to get, too.
> 
>> 
>> A concern was that “the file could get too big.”  So, I arbitrarily limited 
>> each file to 10,000 lines of text when writing to them, trimming the oldest 
>> line if the file length was > 10,000 lines.  
> 
> Would there be an easy way to do this?

Yeah.  I’ll look up the code now.

Cheers.
Alex Zavatone
___

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: Missing log output

2020-11-12 Thread Alex Zavatone via Cocoa-dev
Gabe, let me share the decisions and solutions I went over in my attempting to 
solve this on iOS.

In my first logging, all that I wanted was to be able to get the NSLogs out of 
a file that ONLY had the logs from my app.  I sent you the code for that.

In another app, there were 3 sets of transactions that I cared about.  To keep 
the issues relevent, I logged to 3 separate files and then could transfer each 
as needed.  

Some people hate this.  For me, I put a timestamp on each log event and it 
helped me because I could instantly pay attention to ONLY the info that I 
wanted to pay attention to by opening the file for the issues I cared about.

A concern was that “the file could get too big.”  So, I arbitrarily limited 
each file to 10,000 lines of text when writing to them, trimming the oldest 
line if the file length was > 10,000 lines.  

Securlty.  Would the files need to be encrypted?  To get around this, I just 
made sure not to log any PII and used a lookup to get any special info.

Just some background info on the thought process that was behind several of the 
logging that I put in place over the years.

Cheers.
Alex Zavatone

> On Nov 9, 2020, at 3:23 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> At any rate, it's good to plan ahead and use a different logging mechanism, 
>> one without all the complications and unknowns of the system log.
> 
> Yes, I agree.
> 
> I was thinking of implementing a way such that users can just click on kind 
> of a "Send Log" button, and my app would filter out all the log info from, 
> err ..., the system log
> and send it as an attachment with an email to me.
> 
> Would there be an easy / fail-safe way to filter out all the lines in the 
> system log that pertain to my app?
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Missing log output

2020-11-10 Thread Alex Zavatone via Cocoa-dev
In the approaches that I used, I logged to a specific file so that I can simply 
get that file and send that one.   On iOS, it was simply getting the file from 
the docs folder and either using a mailto: URL or using the 
MFMailComposeViewController.

I don’t know if you’re on iOS or MacOS.  

The other nice thing that you can do is is if you are building in non release 
mode, make sure to redirect the output file to 
/users/Shared/myAwesomeLogfile.txt and make sure to add a datestamp to the file 
name every time you start your app so that you have a log for each app session. 
 



> On Nov 10, 2020, at 4:14 AM, Gabriel Zachmann  wrote:
> 
>> 
>> For logging, my old logging code was replaced by CocoaLumberjack
> 
> A quick glance it it looks interesting.
> Do you know (off the top of your head) whether it puts log message into the 
> general syslog?
> That would be nice because it would make it easy to look at the log message 
> on my side using the regular console 'show' command.
> 
>> which has a max file size and then we would email the log by using 
>> MFMailComposeViewController and MFMailComposeViewControllerDelegate.
> 
> Would you mind sharing a bit of code?
> 

Sure.  I’ll look up the old code for you.

>> 
>> If you wanted to filter out all of the lines you wanted, from the system 
>> log, you could set up a predicate on the name of your app and return the 
>> text that is a log message from your app.  If you want, you can also filter 
>> on a timestamp within now to n weeks or months back.
> 
> Do you have code for that approach, too?
> (I am mostly working with Objective-C)

Yeah, I’ll look around.  
___

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: Missing log output

2020-11-09 Thread Alex Zavatone via Cocoa-dev
For logging, my old logging code was replaced by CocoaLumberjack which has a 
max file size and then we would email the log by using 
MFMailComposeViewController and MFMailComposeViewControllerDelegate.

If you wanted to filter out all of the lines you wanted, from the system log, 
you could set up a predicate on the name of your app and return the text that 
is a log message from your app.  If you want, you can also filter on a 
timestamp within now to n weeks or months back.

Cheers.





> On Nov 9, 2020, at 5:09 PM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> I did something super simple in iOS a few years ago.
> 
> It simply logged to a file in the Documents directory and if there were more 
> than n lines, it would trim the log.  
> 
> Then emailing the log was as simple as issuing a mailto: which opened the log 
> up in the user’s emailer with a title.
> 
> This also allowed me to build a QA screen where I could enable tests and look 
> at states of important objects in the running app.
> 
> I can send you the code if you want once I find it.
> 
> Let me know.
> Alex Zavatone
> 
> 
> 
>> On Nov 9, 2020, at 3:23 PM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>> 
>> 
>>> At any rate, it's good to plan ahead and use a different logging mechanism, 
>>> one without all the complications and unknowns of the system log.
>> 
>> Yes, I agree.
>> 
>> I was thinking of implementing a way such that users can just click on kind 
>> of a "Send Log" button, and my app would filter out all the log info from, 
>> err ..., the system log
>> and send it as an attachment with an email to me.
>> 
>> Would there be an easy / fail-safe way to filter out all the lines in the 
>> system log that pertain to my app?
>> 
>> 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/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Missing log output

2020-11-09 Thread Alex Zavatone via Cocoa-dev
I did something super simple in iOS a few years ago.

It simply logged to a file in the Documents directory and if there were more 
than n lines, it would trim the log.  

Then emailing the log was as simple as issuing a mailto: which opened the log 
up in the user’s emailer with a title.

This also allowed me to build a QA screen where I could enable tests and look 
at states of important objects in the running app.

I can send you the code if you want once I find it.

Let me know.
Alex Zavatone



> On Nov 9, 2020, at 3:23 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> At any rate, it's good to plan ahead and use a different logging mechanism, 
>> one without all the complications and unknowns of the system log.
> 
> Yes, I agree.
> 
> I was thinking of implementing a way such that users can just click on kind 
> of a "Send Log" button, and my app would filter out all the log info from, 
> err ..., the system log
> and send it as an attachment with an email to me.
> 
> Would there be an easy / fail-safe way to filter out all the lines in the 
> system log that pertain to my app?
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: NSScrollView's custom content inset

2020-11-05 Thread Alex Zavatone via Cocoa-dev
Care to post a screenshot of what you expect and what’s happening?

Cheers.
Alex Zavatone

> On Nov 5, 2020, at 1:28 PM, Dragan Milić via Cocoa-dev 
>  wrote:
> 
> Hi all,
> 
> What would be the best approach to set custom insets of the contentView 
> (NSClipView) of a NSScrollView? I’ll try to describe the problem in more 
> details…
> 
> I’m trying to make and application look nice on upcoming Big Sur. The fact 
> that Apple has made it so hard for an application (with reasonably 
> complicated UI) to look good on both Bit Sur and older OS version is a topic 
> for some other rant thread… Anyway, I’m trying to get rid of some unwanted 
> NSTableView properties, introduced in Bit Sur.
> 
> I’ve got a NSTableView with a single column. Cells (NSView based) in that 
> single column show some custom content, mostly custom view full of custom 
> Core Text drawing and colouring. It’s very important (visually appealing) if 
> that custom content is stretched through the whole width of the table
> 
> -- Dragan
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Scaling a UIImage

2020-11-04 Thread Alex Zavatone via Cocoa-dev
I’ve got more if you need to desaturate an image, remove all color, tint a 
bitmap, as opposed to using tint, this actually makes a new tinted bitmap, find 
imageInbundle, create enabled and disabled images from source images and so on.

Sometimes we want to use the actual tint, and other times, if we desaturate an 
image and then apply a tint when creating a new image, then we have a new image 
that is always that way.  

This is iOS specific, and you can save them as you want, but I’ve also got a 
save in documents folder as a data, not as image and a load image from docs.

Let me know which ones you might want and I can send them to you offlist.

Cheers,
Alex Zavatone



> On Nov 4, 2020, at 5:10 PM, Carl Hoefs  wrote:
> 
> Thanks for the UIImage category resizing methods! They are quite useful.
> 
> -Carl
> 
>> On Nov 4, 2020, at 2:17 PM, Alex Zavatone > <mailto:z...@mac.com>> wrote:
>> 
>> Sorry for the delay.  I hope these do what you need.
>> Of course you’ll need to add checks to make sure that you’re not dividing by 
>> zero or nil.
>> 
>> 
>> 
>> // Alex Zavatone 4/2/16.
>> + (UIImage *)imageWithImage:(UIImage *)image 
>> scaledToHeight:(CGFloat)newHeight 
>> {
>> CGFloat ratio = newHeight / image.size.height;
>> CGFloat newWidth = image.size.width * ratio;
>> 
>> CGSize newSize = CGSizeMake(newWidth, newHeight);
>> //UIGraphicsBeginImageContext(newSize);
>> // In next line, pass 0.0 to use the current device's pixel scaling 
>> factor (and thus account for Retina resolution).
>> // Pass 1.0 to force exact pixel size.
>> UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
>> [image drawInRect:CGRectMake(0, 0, newWidth, newHeight)];
>> UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
>> UIGraphicsEndImageContext();
>> return newImage;
>> }
>> 
>> 
>> + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize 
>> {
>> //UIGraphicsBeginImageContext(newSize);
>> // In next line, pass 0.0 to use the current device's pixel scaling 
>> factor (and thus account for Retina resolution).
>> // Pass 1.0 to force exact pixel size.
>> UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
>> [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
>> UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
>> UIGraphicsEndImageContext();
>> return newImage;
>> }
>> 
>> + (UIImage *)imageWithImage:(UIImage *)image 
>> scaledToPercentage:(CGFloat)newScale 
>> {
>> CGSize newSize = CGSizeMake(image.size.width * newScale, 
>> image.size.width * newScale);
>> UIImage *newImage = [self imageWithImage:image scaledToSize:newSize];
>> 
>> return newImage;
>> }
>> 
>> 
>> Cheers,
>> Alex Zavatone
>> 
>> 
>>> On Nov 3, 2020, at 10:34 AM, James Crate via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> On Nov 2, 2020, at 5:59 PM, Carl Hoefs via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>>> I have an iOS app that interacts with a macOS server process. The iOS app 
>>>> takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a 
>>>> JPEG representation of it to send to the server:
>>> 
>>> I have code that does pretty much the same thing, in Swift though so you’ll 
>>> need to convert the API calls to ObjC. Since you’re taking a picture, you 
>>> could use the AVCapturePhoto directly. 
>>> 
>>> 
>>>let capture : AVCapturePhoto
>>>private lazy var context = CIContext()
>>> 
>>>lazy var remotePreviewImage: Data? = {
>>>guard let cgImage = 
>>> self.capture.cgImageRepresentation()?.takeRetainedValue() else { return nil 
>>> }
>>> 
>>>var baseImg = CIImage(cgImage: cgImage)
>>> 
>>>if let orientation = self.capture.metadata[ 
>>> String(kCGImagePropertyOrientation) ] as? Int32 {
>>>baseImg = baseImg.oriented(forExifOrientation: orientation)
>>>}
>>> 
>>>let scalePct = [800.0 / baseImg.extent.size.width, 800.0 / 
>>> baseImg.extent.size.height].max() ?? 0.3
>>>let transformedImg = baseImg.transformed(by: 
>>> CGAffineTransform(scaleX: scalePct, y: scalePct))
>>>print("generated remote preview image \(transformedImg.extent.size)")
&

Re: Scaling a UIImage

2020-11-04 Thread Alex Zavatone via Cocoa-dev
Sorry for the delay.  I hope these do what you need.
Of course you’ll need to add checks to make sure that you’re not dividing by 
zero or nil.



// Alex Zavatone 4/2/16.
+ (UIImage *)imageWithImage:(UIImage *)image scaledToHeight:(CGFloat)newHeight 
{
CGFloat ratio = newHeight / image.size.height;
CGFloat newWidth = image.size.width * ratio;

CGSize newSize = CGSizeMake(newWidth, newHeight);
//UIGraphicsBeginImageContext(newSize);
// In next line, pass 0.0 to use the current device's pixel scaling factor 
(and thus account for Retina resolution).
// Pass 1.0 to force exact pixel size.
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newWidth, newHeight)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}


+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize 
{
//UIGraphicsBeginImageContext(newSize);
// In next line, pass 0.0 to use the current device's pixel scaling factor 
(and thus account for Retina resolution).
// Pass 1.0 to force exact pixel size.
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}

+ (UIImage *)imageWithImage:(UIImage *)image 
scaledToPercentage:(CGFloat)newScale 
{
CGSize newSize = CGSizeMake(image.size.width * newScale, image.size.width * 
newScale);
UIImage *newImage = [self imageWithImage:image scaledToSize:newSize];

return newImage;
}


Cheers,
Alex Zavatone


> On Nov 3, 2020, at 10:34 AM, James Crate via Cocoa-dev 
>  wrote:
> 
> On Nov 2, 2020, at 5:59 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
>> I have an iOS app that interacts with a macOS server process. The iOS app 
>> takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a 
>> JPEG representation of it to send to the server:
> 
> I have code that does pretty much the same thing, in Swift though so you’ll 
> need to convert the API calls to ObjC. Since you’re taking a picture, you 
> could use the AVCapturePhoto directly. 
> 
> 
>let capture : AVCapturePhoto
>private lazy var context = CIContext()
> 
>lazy var remotePreviewImage: Data? = {
>guard let cgImage = 
> self.capture.cgImageRepresentation()?.takeRetainedValue() else { return nil }
> 
>var baseImg = CIImage(cgImage: cgImage)
> 
>if let orientation = self.capture.metadata[ 
> String(kCGImagePropertyOrientation) ] as? Int32 {
>baseImg = baseImg.oriented(forExifOrientation: orientation)
>}
> 
>let scalePct = [800.0 / baseImg.extent.size.width, 800.0 / 
> baseImg.extent.size.height].max() ?? 0.3
>let transformedImg = baseImg.transformed(by: CGAffineTransform(scaleX: 
> scalePct, y: scalePct))
>print("generated remote preview image \(transformedImg.extent.size)")
> 
>let colorspace : CGColorSpace = baseImg.colorSpace ?? 
> CGColorSpace(name: CGColorSpace.sRGB)!
>let compressionKey = CIImageRepresentationOption(rawValue: 
> kCGImageDestinationLossyCompressionQuality as String)
>let data = self.context.jpegRepresentation(of: transformedImg, 
> colorSpace: colorspace,
>   options: [compressionKey : 
> 0.6])
>print("photo generated preview \(data?.count ?? 0) bytes")
>return data
>}()
> 
> 
> I had a previous version that used ImageIO. I don’t remember why I switched 
> but I still had the commented code hanging around.  
> 
> //lazy var remotePreviewImage: Data? = {
> //guard let data = self.capture.fileDataRepresentation() else { 
> return nil }
> //guard let src = CGImageSourceCreateWithData(data as NSData, nil) 
> else { return nil }
> //let thumbOpts = [
> //kCGImageSourceCreateThumbnailFromImageAlways: true,
> //kCGImageSourceCreateThumbnailWithTransform: true,
> //kCGImageSourceThumbnailMaxPixelSize: 800,
> //] as [CFString : Any]
> //
> //if let cgImage = CGImageSourceCreateThumbnailAtIndex(src, 0, 
> thumbOpts as CFDictionary) {
> //// create jpg data
> //let data = NSMutableData()
> //
> //if let dest = CGImageDestinationCreateWithData(data, 
> kUTTypeJPEG, 1, nil) {
> //CGImageDestinationAddImage(dest, cgImage, 
> [kCGImageDestinationLossyCompressionQuality: 0.6] as CFDictionary)
> //CGImageDestinationFinalize(dest)
> //}
> //print("getP

Re: Scaling a UIImage

2020-11-02 Thread Alex Zavatone via Cocoa-dev
I’lll dig up a utility class that I made for UIImage that has this as well as 
others.

Cheers.

> On Nov 2, 2020, at 4:59 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels?
> 
> 
> I have an iOS app that interacts with a macOS server process. The iOS app 
> takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a JPEG 
> representation of it to send to the server:
> 
>  NSData *dataObj = UIImageJPEGRepresentation(origImage,0.5);
> 
> The server reads the bytes, and creates an NSImage:
> 
>  NSImage *theImage = [[NSImage alloc] initWithData:imageData];
>  NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] 
> initWithData:[theImage TIFFRepresentation]];
> 
> But at this point, imageRep.pixelsWide=1280 and imageRep.pixelsHigh=960!
> 
> If I write theImage to disk and look at it with Preview, it displays onscreen 
> as 640x480 but Preview's Inspector Tool shows it to be 1280x960.
> 
> On the iOS app side, here's the UIImage category method I'm using to scale 
> the image:
> 
> + (UIImage *)imageWithImage:(UIImage *)image 
>   scaledToSize:(CGSize)newSize 
> {
>UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
>[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
>UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
>UIGraphicsEndImageContext();
>return newImage;
> }
> 
> Any suggestions?
> -Carl
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: How to parse a log file

2020-10-27 Thread Alex Zavatone via Cocoa-dev
If you upload your build (iOS) to the iTunes connect, I do believe that the 
dSym goes up as well.

Look at the build script for Crashlytics.  It makes sure to upload your dSyms 
and does the symbolicating for iOS apps.

The process already exists with these and other crash tracking tools.

It’s pretty established already.

It’s not impossible to do.

> On Oct 27, 2020, at 12:54 AM, Rob Petrovec via Cocoa-dev 
>  wrote:
> 
> 
> 
>> On Oct 26, 2020, at 10:00 PM, Steven Mills via Cocoa-dev 
>>  wrote:
>> 
>> 
>>> On Oct 26, 2020, at 17:49:59, James Walker via Cocoa-dev 
>>>  wrote:
>>> 
>>> I don't see any "Download Debug Symbols" in the Organizer.  I don't think 
>>> it exists for macOS apps.
>>> 
>>> However, one can right-click on an archive and select "Show In Finder", 
>>> then once in Finder right-click again and Show Package Contents, and drill 
>>> down to find dSyms.  (Usually just one, but if your app builds with a 
>>> private framework, there could be more.)
>> 
>> Yes, Apple needs to remember when writing docs that not all apps are for 
>> mobile! I have to refer to that doc every time I get a user crashlog, once 
>> or twice a year, and it always take the same amount of time to figure out 
>> what they're talking about. I really hope they make this a more automatic 
>> feature in Xcode: Open the project, open a crashlog, choose a menu item to 
>> symbolicate, and let Xcode do the confusing part about loading the dsym from 
>> the archives.
>   While I agree this would be a good thing to have, I don’t see how Xcode 
> could find the dSYM to use given that they are typically ephemeral.  The dSYM 
> is tied to the build.  So if you build your project twice you will have two 
> different dSYMs. Only the dSYM for the build that generated the crash log 
> file will be able to symbolicate it.  So, if you want to symbolicate your 
> crash logs you need to save your dSYM files & resulting app bundle somewhere 
> for each build of your app you publish.  Then you can use them to symbolicate 
> user logs.
>   What Xcode could do, however, is (given a path to a directory 
> containing all the dSYMs for your published builds) parse the log to figure 
> out which dSYM/app bundle pair in the directory to use (probably based on 
> build info and/or version) and symbolicate.  You would also need to take the 
> additional step of properly updating these values in your project for each 
> published build.
> 
>   Either way, that sounds like a reasonable request to make. You should 
> write up a bug report and send it to Apple.
> 
> —Rob
> 
> 
>> ___
>> 
>> 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
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: How to parse a log file

2020-10-26 Thread Alex Zavatone via Cocoa-dev
As a note to Jens’s tip, it’s important to keep the .dSWM files for your 
releases so that you can symbolicate your crash logs.  Crashlytics does this 
for you, but the debug symbols are stripped from released builds to try and 
prevent people from reverse engineering your code and to make the executable 
smaller.

If you have access to the build Mac that the execurable was made on, you should 
be able to check in the Organizer window and look for Download Debug Symbols.

And Google for xcode symbolicate binary.

https://developer.apple.com/documentation/xcode/diagnosing_issues_using_crash_reports_and_device_logs/adding_identifiable_symbol_names_to_a_crash_report?language=objc

Alex Zavatone


> On Oct 26, 2020, at 5:19 PM, Jens Alfke via Cocoa-dev 
>  wrote:
> 
> 
> 
>> On Oct 26, 2020, at 3:01 PM, Gabriel Zachmann via Cocoa-dev 
>>  wrote:
>> 
>> Is it possible to determine the exact line in the source code where the 
>> error occurred?
> 
> The "+ " thing in each stack line is the byte offset from the start of 
> the function, in the machine code. Not super useful by itself … 
> 
> If the symbol is simply "MyAppName + " with no function/method, then no 
> symbols for your code were available at the time of the crash. That means 
> they weren't embedded in the code, and no dSYM file was found.
> 
> Or, if the offset is unrealistically large (like hundreds of KB), then the 
> function/method name is bogus and is simply the nearest named symbol that the 
> stack-dump code could find.
> 
> I believe it's possible to use the .dSYM file that was produced with the 
> release build of _that exact version_ of your app, to convert those offsets 
> into line numbers — there's a tool called "symbolicate" or something like 
> that. I have never done this myself so I don't know the details.
> 
> —Jens
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: How to parse a log file

2020-10-26 Thread Alex Zavatone via Cocoa-dev
Starting with Gabriel’s comment.

We can see that at line 2, we have this.
NSCFString characterAtIndex:

And on line 1, we have the thrown exception.

If I’m correct, the assumption here is thatthe operation is trying to get the 
first character of a a string at index 0 and there isn’t any, so the exception 
is thrown.  This indicates a nil string.  Looking at the lines until line 6 
(Gabriel says 7 and he is right, but the line is labeled as 6), the array is 
allocated with an object.  This object is probably nil, which caused the error 
on line 2.

Checks can be written to Gabriel and myself.  Or use PayPal.  : D

I hope this is a correct explanation of how Gabriel got to the answer he 
mentioned.

Alex Zavatone


> On Oct 26, 2020, at 5:01 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> From a user, I received a log file that contains an error (see below)
> and a stack trace of my macOS app.
> 
> Is it possible to determine the exact line in the source code where the error 
> occurred?
> 
> Best regards, Gabriel
> 
> 
> Encl:
> excerpt from log.
> "ArtSaverApp"  is my macOS app.
> 
> 
> 2020-10-23 10:47:30.410560-0400 0x2318dError   0x0  
> 6750   0ArtSaverApp: (AppKit) [com.apple.AppKit:General] *** 
> -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object 
> from objects[0]
> 2020-10-23 10:47:30.433412-0400 0x2318dError   0x0  
> 6750   0ArtSaverApp: (AppKit) [com.apple.AppKit:General] (
>   0   CoreFoundation  0x7fff2d796b57 
> __exceptionPreprocess + 250
>   1   libobjc.A.dylib 0x7fff664475bf 
> objc_exception_throw + 48
>   2   CoreFoundation  0x7fff2d84559e 
> -[__NSCFString characterAtIndex:].cold.1 + 0
>   3   CoreFoundation  0x7fff2d8438c4 
> -[__NSPlaceholderArray initWithCapacity:].cold.1 + 0
>   4   CoreFoundation  0x7fff2d69a8ae 
> -[__NSPlaceholderArray initWithObjects:count:] + 154
>   5   CoreFoundation  0x7fff2d6fff7e 
> __createArray + 47
>   6   CoreFoundation  0x7fff2d6fff41 +[NSArray 
> arrayWithObject:] + 25
>   7   ArtSaverApp 0x000109f12466 ArtSaverApp 
> + 46182
>   8   ArtSaverApp 0x000109f1598d ArtSaverApp 
> + 59789
>   9   AppKit  0x7fff2abcd7a7 
> -[NSApplication(NSResponder) sendAction:to:from:] + 299
>   10  AppKit  0x7fff2abcd642 -[NSControl 
> sendAction:to:] + 86
>   11  AppKit  0x7fff2abcd574 __26-[NSCell 
> _sendActionFrom:]_block_invoke + 136
>   12  AppKit  0x7fff2abcd476 -[NSCell 
> _sendActionFrom:] + 171
>   13  AppKit  0x7fff2abcd3bd 
> -[NSButtonCell _sendActionFrom:] + 96
>   14  AppKit  0x7fff2abc969b 
> NSControlTrackMouse + 1745
>   15  AppKit  0x7fff2abc8fa2 -[NSCell 
> trackMouse:inRect:ofView:untilMouseUp:] + 130
>   16  AppKit  0x7fff2abc8e61 
> -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 691
>   17  AppKit  0x7fff2abc81dd -[NSControl 
> mouseDown:] + 748
>   18  AppKit  0x7fff2abc65f0 
> -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4914
>   19  AppKit  0x7fff2ab30e21 
> -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
>   20  AppKit  0x7fff2ab301c9 
> -[NSWindow(NSEventRouting) sendEvent:] + 349
>   21  AppKit  0x7fff2ab2e554 
> -[NSApplication(NSEvent) sendEvent:] + 352
>   22  AppKit  0x7fff2a97b5bf 
> -[NSApplication run] + 707
>   23  AppKit  0x7fff2a94d396 
> NSApplicationMain + 777
>   24  libdyld.dylib   0x7fff675efcc9 start + 1
> )
> 
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Alex Zavatone via Cocoa-dev
Just try the simple code I supplied with a 1, 2, second update time.  If you 
find that it doesn’t work, it’s 5 minutes spent.  If you find that it does, 
just figure out the update time that you want.  1/2 a second?  1/10 of a second?

The other thing you can have is a “hasTheDataChanged” setting and only proceed 
to check on the next update time throttle if the data has changed.
 
It’s akin to a dirty bit on a file.

CoreData does that with a hasUpdated or hasBeenUpdated setting so you don’t 
need to resave data needlessly.



> On Oct 23, 2020, at 10:51 AM, Andreas Falkenhahn  
> wrote:
> 
> The problem with that approach is that I'd need to find out the monitor's 
> refresh rate in order to calculate "nextUpdateTime" and I'm not sure if I can 
> get this information from all monitors reliably.
> 
> On 19.10.2020 at 00:09 Alex Zavatone wrote:
> 
>> It shouldn’t be too hard to roll your own simply based on milliseconds of a 
>> timer.
> 
>> Even a simple 
> 
> if (myMilliseconds >> nextUpdateTime) {
>>[updateObject doThatUpdate];
>>nextUpdateTime = myMilliseconds + msThrottle;
>> }
> 
>> lets you get a basic throttle.
>> 
>> Cheers, 
>> Alex Zavatone
> 
>>> On Oct 15, 2020, at 2:13 PM, Andreas Falkenhahn via Cocoa-dev 
>>>  wrote:
> 
>>> I'm drawing inside an NSView by simply setting its layer's contents to a 
>>> CGImage which is updated for every frame, e.g. something like this:
> 
>>>  dp = CGDataProviderCreateWithData(NULL, frameBuf, frameBufSize, NULL);
>>>  im = CGImageCreate(frameWidth, frameHeight, 8, 32, frameStride, 
>>> theColorSpace, (CGBitmapInfo) kCGImageAlphaNoneSkipFirst, dp, NULL, FALSE, 
>>> kCGRenderingIntentDefault);
> 
>>>  view.layer.contents = (id) im;
>>>  CGImageRelease(im);
>>>  CGDataProviderRelease(dp);
> 
>>> This works fine except that there is no throttle so this will draw as fast 
>>> as the CPU allows, which of course is a waste of CPU cycles because the 
>>> monitor only refreshes a certain amount of times per second.
> 
>>> So is there a convenient way to throttle drawing to the monitor's refresh 
>>> rate or does this have to be done the hard way by querying the monitor's 
>>> refresh rate and then setting up a timer which draws in exactly those 
>>> refresh intervals or how should this be done?
> 
>>> Note that I'd like to avoid using OpenGL or Metal or whatever is the 
>>> standard nowadays but I'm mainly interested in an AppKit solution...
> 
>>> -- 
>>> Best regards,
>>> Andreas Falkenhahn  mailto:andr...@falkenhahn.com
> 
>>> ___
> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
>>> This email sent to z...@mac.com
> 
> 
> 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 

___

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

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

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

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


Re: Throttling drawing to vertical refresh

2020-10-23 Thread Alex Zavatone via Cocoa-dev
Naaah, it’s not that.  The OSes draw code already handles that at a much lower 
level.  You’re just creating what is a maximum update throttle.  You’re not 
blitting pixels in a video card driver.

You can try my simple approach and just declare the next update time to be the 
current time + 1 second.  It should work without screen flicker at all.

We’re not doing low level code.  As far as i know, the MacOS code has a triple 
buffered system that already handles that.

> On Oct 23, 2020, at 10:51 AM, Andreas Falkenhahn  
> wrote:
> 
> The problem with that approach is that I'd need to find out the monitor's 
> refresh rate in order to calculate "nextUpdateTime" and I'm not sure if I can 
> get this information from all monitors reliably.
> 
> On 19.10.2020 at 00:09 Alex Zavatone wrote:
> 
>> It shouldn’t be too hard to roll your own simply based on milliseconds of a 
>> timer.
> 
>> Even a simple 
> 
> if (myMilliseconds >> nextUpdateTime) {
>>[updateObject doThatUpdate];
>>nextUpdateTime = myMilliseconds + msThrottle;
>> }
> 
>> lets you get a basic throttle.
>> 
>> Cheers, 
>> Alex Zavatone
> 
>>> On Oct 15, 2020, at 2:13 PM, Andreas Falkenhahn via Cocoa-dev 
>>>  wrote:
> 
>>> I'm drawing inside an NSView by simply setting its layer's contents to a 
>>> CGImage which is updated for every frame, e.g. something like this:
> 
>>>  dp = CGDataProviderCreateWithData(NULL, frameBuf, frameBufSize, NULL);
>>>  im = CGImageCreate(frameWidth, frameHeight, 8, 32, frameStride, 
>>> theColorSpace, (CGBitmapInfo) kCGImageAlphaNoneSkipFirst, dp, NULL, FALSE, 
>>> kCGRenderingIntentDefault);
> 
>>>  view.layer.contents = (id) im;
>>>  CGImageRelease(im);
>>>  CGDataProviderRelease(dp);
> 
>>> This works fine except that there is no throttle so this will draw as fast 
>>> as the CPU allows, which of course is a waste of CPU cycles because the 
>>> monitor only refreshes a certain amount of times per second.
> 
>>> So is there a convenient way to throttle drawing to the monitor's refresh 
>>> rate or does this have to be done the hard way by querying the monitor's 
>>> refresh rate and then setting up a timer which draws in exactly those 
>>> refresh intervals or how should this be done?
> 
>>> Note that I'd like to avoid using OpenGL or Metal or whatever is the 
>>> standard nowadays but I'm mainly interested in an AppKit solution...
> 
>>> -- 
>>> Best regards,
>>> Andreas Falkenhahn  mailto:andr...@falkenhahn.com
> 
>>> ___
> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
>>> This email sent to z...@mac.com
> 
> 
> 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 

___

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

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

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

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


Re: Throttling drawing to vertical refresh

2020-10-18 Thread Alex Zavatone via Cocoa-dev
It shouldn’t be too hard to roll your own simply based on milliseconds of a 
timer.

Even a simple 

if (myMilliseconds > nextUpdateTime) {
[updateObject doThatUpdate];
nextUpdateTime = myMilliseconds + msThrottle;
}

lets you get a basic throttle.

Cheers, 
Alex Zavatone

> On Oct 15, 2020, at 2:13 PM, Andreas Falkenhahn via Cocoa-dev 
>  wrote:
> 
> I'm drawing inside an NSView by simply setting its layer's contents to a 
> CGImage which is updated for every frame, e.g. something like this:
> 
>   dp = CGDataProviderCreateWithData(NULL, frameBuf, frameBufSize, NULL);
>   im = CGImageCreate(frameWidth, frameHeight, 8, 32, frameStride, 
> theColorSpace, (CGBitmapInfo) kCGImageAlphaNoneSkipFirst, dp, NULL, FALSE, 
> kCGRenderingIntentDefault);
> 
>   view.layer.contents = (id) im;
>   CGImageRelease(im);
>   CGDataProviderRelease(dp);
> 
> This works fine except that there is no throttle so this will draw as fast as 
> the CPU allows, which of course is a waste of CPU cycles because the monitor 
> only refreshes a certain amount of times per second.
> 
> So is there a convenient way to throttle drawing to the monitor's refresh 
> rate or does this have to be done the hard way by querying the monitor's 
> refresh rate and then setting up a timer which draws in exactly those refresh 
> intervals or how should this be done?
> 
> Note that I'd like to avoid using OpenGL or Metal or whatever is the standard 
> nowadays but I'm mainly interested in an AppKit solution...
> 
> -- 
> Best regards,
> Andreas Falkenhahn  mailto:andr...@falkenhahn.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Rotating NSTextField 90 degrees

2020-09-24 Thread Alex Zavatone via Cocoa-dev
http://digerati-illuminatus.blogspot.com/2009/09/how-do-you-rotate-nsbutton-nstextfield.html



> On Sep 24, 2020, at 11:09 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> In my MacOS app I need to display some vertical text (normal text rotated 90 
> degrees counterclockwise).
> 
> I don't see anything in NSTextField or Xcode IB that allows a change of 
> orientation. Could NSAttributedString be used to do this, or is there some 
> CoreGraphics way?
> 
> -Carl
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


Re: Rotating NSTextField 90 degrees

2020-09-24 Thread Alex Zavatone via Cocoa-dev
Check out 

frameRotation or 

myView.wantsLayer = YES;
myView.layer.transform = CATransform3DMakeRotation(angle, 
0, 0, 1);

There is this too.

https://developer.apple.com/documentation/appkit/nsview/1483444-rotate 


https://developer.apple.com/documentation/appkit/nsview/1483444-rotatebyangle?language=objc


> On Sep 24, 2020, at 11:09 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> In my MacOS app I need to display some vertical text (normal text rotated 90 
> degrees counterclockwise).
> 
> I don't see anything in NSTextField or Xcode IB that allows a change of 
> orientation. Could NSAttributedString be used to do this, or is there some 
> CoreGraphics way?
> 
> -Carl
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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

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

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

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


  1   2   3   4   5   6   7   8   9   10   >