Re: Code signing checking

2023-01-29 Thread Stephane Sudre via Cocoa-dev
Is this to prevent your executable from loading plugins that are not signed
with your team ID?

Because, in this case, this would look like what the Hardened runtime does.

On Fri, Jan 6, 2023 at 9:29 PM Aandi Inston via Cocoa-dev <
cocoa-dev@lists.apple.com> wrote:

> Is there any API for doing the following activities related to code
> signing?
> - Check that the signature on the running codesigned executable is from the
> same company as the signature on a bundle?
> OR
> - Get the company from the codesigned running executable and
> - Get the company from a signature on a bundle
> (so we can check they are the same).
>
> I think this can be done calling and reading output from the codesign CLI,
> but an API seems tidier.
>
> Reference to detailed reading is fine!!
> Thanks in advance!
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com
>
> This email sent to dev.iceb...@gmail.com
>


-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html
___

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

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

Help/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: /Library/Application Support off limits?

2021-04-15 Thread Stephane Sudre via Cocoa-dev
I'm not sure to understand why you think a folder whose path is
/Users/Shared could not be used to share things among users.

If the issue you see is that once a user creates a file or directory
in /Users/Shared, only this user can manipulate them, just change the
POSIX permissions to make them editable by other users.

On Thu, Apr 15, 2021 at 9:37 AM Davidap via Cocoa-dev
 wrote:
>
> Becouse is not a good place for sharing things since it is not accessible by 
> anyone but the ~ user.
>
> Davidap
>
> El 14/4/21 a las 18:41, Ben Kennedy escribió:
> >
> >> On 14 Apr 2021, at 1:14 am, Davidap via Cocoa-dev 
> >>  wrote:
> >>
> >> Apple say:
> >>
> >> [...] For example, if your app is named MyApp and has the bundle 
> >> identifier com.example.MyApp, you would put your app’s user-specific data 
> >> files and resources in the ~/Library/Application 
> >> Support/com.example.MyApp/ directory. Your app is responsible for creating 
> >> this directory as needed.
> >>
> >> Our app isn't sandboxed, but when I try to create a "/Library/Application 
> >> Support/NewFolder" folder in there I get the following message:
> >>
> >> /*You don't have permission to save the file "NewFolder" in the folder 
> >> "Application Support."*/
> > You misread. The passage you quoted above indicates "~/Library/Application 
> > Support"; i.e. under the Library inside the user's home directory.
> >
> >> I can't find anywhere else suitable to use for sharing files that need to 
> >> be read and written by different users - /Users/Shared doesn't seem right
> > Why not?
> >
> > -ben
> >
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com
>
> This email sent to dev.iceb...@gmail.com



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html
___

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

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

Help/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: Exception not being caught in try statement

2021-03-27 Thread Stephane Sudre via Cocoa-dev
It's trying to insert a NSTextTab * object.


On Fri, Mar 26, 2021 at 12:11 PM Mark Allan via Cocoa-dev
 wrote:
>
> Hi folks,
>
> Some users are reporting a crash that I can't reproduce, and in an attempt to 
> gain additional diagnostics from a user, I wrapped the affected line in a 
> try/catch block.  For two users it resolve the crash, but for a third, it's 
> still crashing at the same point!
>
> The crash occurs when a user attempts to open the "About" window from my 
> app's main menu item. I'm not using the standard about panel as there's a few 
> additional items I need to display, one of which is an NSTextView which I 
> populate with the contents of an RTF file from within the app bundle.
>
> I've symbolicated the crash log to find it's happening when populating that 
> TextView. The line in question now reads as follows:
>
> @try {
> [self.aboutBox.creditsTextView readRTFDFromFile:[[NSBundle 
> mainBundle] pathForResource:@"Credits" ofType:@"rtf"]];
> } @catch (NSException *exception) {
> NSLog(@"Error loading the contents of the text file for the 
> About Box. %@", exception);
> //Check we have a file at the expected path
> if([[NSFileManager defaultManager] 
> fileExistsAtPath:[[NSBundle mainBundle] pathForResource:@"Credits" 
> ofType:@"rtf"]]){
> NSLog(@"Yes. Found the RTF credits file");
> // check the attributes in case somehow there's no 
> permission to read the file
> NSDictionary *fileAttributes = [[NSFileManager 
> defaultManager] attributesOfItemAtPath:[[NSBundle mainBundle] 
> pathForResource:@"Credits" ofType:@"rtf"] error:nil];
> NSLog(@"RTF file has following attributes %@", 
> fileAttributes);
> }
> else {
> NSLog(@"Nope, file not found");
> }
> }
>
> This is the crash log from the newest build (with the try/catch around that 
> line):
>
> > Performing @selector(showAboutBox:) from sender NSMenuItem 0x60634540
> > *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
> > reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
> > terminating with uncaught exception of type NSException
> > abort() called
> >
> > Application Specific Backtrace 1:
> > 0   CoreFoundation  0x7fff206ea6af 
> > __exceptionPreprocess + 242
> > 1   libobjc.A.dylib 0x7fff204223c9 
> > objc_exception_throw + 48
> > 2   CoreFoundation  0x7fff2079ea9a -[__NSCFString 
> > characterAtIndex:].cold.1 + 0
> > 3   CoreFoundation  0x7fff2079c953 -[__NSArrayM 
> > insertObject:atIndex:].cold.2 + 0
> > 4   CoreFoundation  0x7fff20610421 -[__NSArrayM 
> > insertObject:atIndex:] + 1135
> > 5   UIFoundation0x7fff23c223ab 
> > __defaultTabStops_block_invoke + 161
> > 6   libdispatch.dylib   0x7fff203cd7c7 
> > _dispatch_client_callout + 8
> > 7   libdispatch.dylib   0x7fff203ce96b 
> > _dispatch_once_callout + 20
> > 8   UIFoundation0x7fff23c229d7 
> > -[NSMutableParagraphStyle setTabStops:] + 199
> > 9   UIFoundation0x7fff23c3c697 -[NSRTFReader 
> > defaultParagraphStyle] + 75
> > 10  UIFoundation0x7fff23c3c5be -[NSRTFReader 
> > _mutableParagraphStyle] + 112
> > 11  UIFoundation0x7fff23c36113 controlClass + 
> > 1757
> > 12  UIFoundation0x7fff23c356b4 -[NSRTFReader 
> > attributedString] + 76
> > 13  UIFoundation0x7fff23c311a6 
> > _NSReadAttributedStringFromURLOrData + 3213
> > 14  UIFoundation0x7fff23d46985 
> > -[NSAttributedString(NSAttributedStringUIFoundationAdditions) 
> > initWithURL:options:documentAttributes:error:] + 228
> > 15  AppKit  0x7fff23677d9a -[NSTextView 
> > readRTFDFromFile:] + 126
> > 16  MyAppHere 0x000105fa18a7 MyAppHere+ 
> > 227495
> > 17  AppKit  0x7fff230af7fd 
> > -[NSApplication(NSResponder) sendAction:to:from:] + 283
> > 18  AppKit  0x7fff231b2611 -[NSMenuItem 
> > _corePerformAction] + 413
>
>
> Any ideas what's going on? Other than the file not being found, why else 
> might the object at line 3 in the backtrace be nil...and more interestingly, 
> why is the exception not being caught?
>
> 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:
>

NSCollectionView + custom layout => missing vertical drop line

2020-07-14 Thread Stephane Sudre via Cocoa-dev
I'm currently playing with NSCollectionView (10.11+ behavior) and have
not been able to figure out a mystery when it comes to drag and drop.

I have a NSCollectionView with a custom layout.

The layout is based on the standard grid layout with the following
modifications in mind:

- there can only be one row.
- there are as many columns as items.
- the collection view can be scrolled horizontally.
- the width of the items is fixed.
- the height of the items is the height of the contents.

The mystery I'm facing is that during a local drag and drop (to switch
items), the vertical line indicating the target of the drop does not
appear.

The mysterious side here is that if I change the maximumNumberOfRows
to 0, it does appear but I lose the horizontal scrolling.

Since this is the first time I try to use the NSCollectionView class
with a custom layout, I'm probably doing something wrong. But I have
not found so far an obvious solution from the miscellaneous tutorials
here and there.

So if anyone has an idea what's wrong, I'm interested.

Sample project:

Warning: the drop indexes are computed incorrectly for the moment.
Dragging and dropping the first card between the second and third ones
is safe.

https://drive.google.com/file/d/1LsDrWjK7vg3ET8yGLaLR1OpojfA4Tlrr/view?usp=sharing
___

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

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

Help/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: Curious bug in oPanel under Mojave in screensaver

2020-05-28 Thread Stephane Sudre via Cocoa-dev
It's a known issue in all 10.14 versions and some 10.15 versions.

Apple broke NSOpenPanel when they sandboxed the screensaver pref pane.
They also broke window focus BTW.

2 issues can be observed:

- you select a file, you get the parent folder.
- you switch to the list view mode and you can freeze/crash the System
Preferences application.

Basically, 10.14 and 10.5 have been huge nightmares when it comes to
screen savers.

On Thu, May 28, 2020 at 1:40 PM Gabriel Zachmann via Cocoa-dev
 wrote:
>
> I have screensaver where the user can select a folder through the options 
> sheet.
> In that sheet,  I open an NSOpenPanel, make a few settings, runModal,
> let the user navigate and choose a folder, then get oPanel.URL.
> (Complete code below.)
>
> The curious thing is:
> The oPanel returns only the folder that appeared at the top of the dialog in 
> the dropdown.
> In other words, when a user navigates to some folder A, then clicks on a 
> folder B inside A,
> then closes the panel (clicking "Open"), then oPanel.URL still returns A.
> The user has to navigate *into* B for the oPanel to return B.
>
> This funny behavior seems to occur only under Mojave (not Catalina),
> and it seems to occur only in the screensaver.
> Exactly the same code under Mojave works as expected when used in a 
> stand-alone app.
>
> My question is: does anyone have an idea what might be causing this?
> Am I missing something?
> Or is it "just" a bug in AppKit or the screensaverengine under Mojave?
>
> Thanks a lot in advance for all kinds of hints and insights.
>
> Best regards, Gabriel
>
>
> Enc:
>
> Complete code for my open dialog:
>
> NSOpenPanel *oPanel = [NSOpenPanel openPanel];
> [oPanel setDirectoryURL: dir];
> [oPanel setAllowsMultipleSelection: NO];
> [oPanel setCanChooseDirectories: YES];
> [oPanel setCanChooseFiles: NO];
> long int result = [oPanel runModal];
> new_url = oPanel.URL;
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com
>
> This email sent to dev.iceb...@gmail.com



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html
___

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

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

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

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


Re: Thoughts on productivity

2019-10-24 Thread Stephane Sudre via Cocoa-dev
On Fri, Oct 25, 2019 at 12:38 AM Rob Petrovec via Cocoa-dev
 wrote:
> If its a ranty bug report, which apparently happens a lot, it goes into a 
> black-hole never to see the light of day if it doesn’t just get closed right 
> off the bat.  So try to keep opinions & criticisms out of it.  Just the facts 
> and keep it professional.

Not fixing an issue because the bug report is ranty is definitely not
professional.
___

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

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

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

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


Re: Need for Swift

2019-10-16 Thread Stephane Sudre via Cocoa-dev
On Tue, Oct 15, 2019 at 2:26 PM Sandor Szatmari via Cocoa-dev
 wrote:

> But honestly, I don’t have enough Swift experience to know if you can write 
> bad Swift code.

I'm just reading Swift code here and there and it's my personal
opinion that 75% of the Swift code I read is bad code.

By bad code, I mean code suffering from the "only God and I know what
I'm doing" syndrome.

The same syndrome that you can find in software using Cocoa bindings.
The same software that is terrible to maintain, even more when you're
not the original author (and you're obviously not God).

Why do Swift developers think it's mandatory to write code that is illegible?
Is Swift mainly used by freelances or consultants that will not have
to maintain the software?
___

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

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

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

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


Re: Thoughts on Cocoa source code

2019-10-10 Thread Stephane Sudre via Cocoa-dev
On Wed, Oct 9, 2019 at 7:19 PM Turtle Creek Software via Cocoa-dev
 wrote:
>
> Why is Cocoa source code hidden?
>
> Many of the frustrations we had with the 64-bit update attempt were caused
> by Cocoa's lack of visible source. It was a "black box" that often required
> trial-and-error to figure out. Yeah, the headers are visible, and Apple has
> info online. But sometimes that was not sufficient to understand the actual
> implementation details.

Cocoa source code is not really hidden if you use the proper tools and
know how to use them and that you should not rely 100% on them.

With Hopper Disassembler, you can see any Obj-C framework source code
in /System/Library/(Private)Frameworks.

Although most of the time you don't need to see the source code, there
are some areas that are poorly covered by the developer documentation
and being able to see the implementation details is very useful. For
instance, if you ever had to write a custom subclass of NSCell or a
subclass of NSControl with multiple cells, the official documentation
was almost totally useless and this was a good opportunity to find out
about the private API Apple was keeping to itself to make the AppKit
controls work.

It's true that having access to the source code can also help finding
issues and suggesting patches. But it's also true that if Apple had
been doing a proper job at checking the warnings and static analysis
outputs of its own IDE, numerous issues could have been fixed without
having needed to be reported by 3rd party developers.

If you combine otool, classdump and Hopper Disassembler, you can find
how some Cocoa methods are working in any Obj-C executable pretty
easily.

https://www.hopperapp.com

http://stevenygard.com/projects/class-dump/

Checking cocotron can also be helpful if you want to see how someone
else implemented most Foundation and AppKit legacy APIs.
___

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

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

Help/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 icon ?

2019-09-17 Thread Stephane Sudre via Cocoa-dev
For the record, due to Apple's inability to support 3rd party screen
saver seriously, the custom icons for 3rd party screen savers are
displayed incorrectly and differently depending on the OS versions.

So don't spend too much time on getting your screen saver icon to be
pixel perfect. The Desktop and Screen Saver pref pane will always do
its best to ruin it.

On Tue, Sep 17, 2019 at 10:09 AM Felix Franz via Cocoa-dev
 wrote:
>
> Hi Gabriel,
>
>
> looks like the file Contents/Resources/thumbnail.png (or .tiff) in the bundle 
> is used. If I replace this file it simply shows up.
>
>
> Cheers,
>
>
> Felix
>
>
>
>  From:   Gabriel Zachmann via Cocoa-dev 
>  To:   
>  Sent:   9/17/2019 9:26 AM
>  Subject:   Screensaver icon ?
>
> Does anybody know how I can define/set the icon for my screensaver that 
> appears in the left hand sidebar of System Preferences / Desktop & 
> Screensaver / Screensaver ?
>
> More specifically:
> I am writing a screensaver, it works and appears in the sidebar in the System 
> Preferences Screensavers pane.
> But it has this default icon (blue swirl).
> I would like to change that to a different image/icon.
>
> What do I need to do in my code to achieve that?
>
> I checked Apple's ScreenSaver documentation, and also googled , to no avail.
>
> All hints 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/felix.franz%40ergosign.de
>
> This email sent to felix.fr...@ergosign.de
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com
>
> This email sent to dev.iceb...@gmail.com



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html
___

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

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

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

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