Date   

Re: When does AppDelegate:applicationDidFinishLaunching get called?

Dave
 

The thing is, this Code is supposed to initialize the App Sub-system before any other parts of the App get called. If I put it in AwakeFromNib then the initalization will be dependant of which Window or View Controller gets called first.

I had thought that applicationDidFinishLaunching was a safe place to put this code, but for some reason it doesn’t seem to work anymore.

All the Best
Dave

On 14 Jan 2020, at 17:32, Sandor Szatmari <admin.szatmari.net@gmail.com> wrote:

-(void)awakeFromNib might work for you.

Sandor

On Jan 14, 2020, at 11:13, Dave <dave@looktowindward.com> wrote:

Mac Project.
MacOS 10.14.6

Hi All,

I have some code that needs to be initialized before any Window/View are displayed. The App was working ok, but it looks like something has changed?

I have a call to initialise AppDelegate:applicationDidFinishLaunching BUT, the Initial Window/View Controller viewDidAppear method is being called before applicationDidFinishLaunching. Is this correct behaviour and if so where is the best place to initialise things?

Thanks a lot
All the Best
Dave





Re: When does AppDelegate:applicationDidFinishLaunching get called?

Dave
 

Hi,

It seems that whichever method I use, the view get called first. I need a way of initialising App Sub-systems before any view gets called. I’m not sure if this has changed or not or whether its because I’m using Storyboards. I have a "main.storyboard” that’s gets setup automatically be the OS. I think before I was manually instantiating the Window/View Controller from a NIB file.

So, does the Views inside "main.storyboard” get initialized before applicationWillFinishLaunching/applicationDidFinishLaunching get called?

Thanks a lot for your help
Dave

On 14 Jan 2020, at 17:25, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

You can also look at other methods in the AppDelegate, such as init, applicationWillFinishLaunchingWithOptions and so on.

Just look at the header. They are easy to try.
On Jan 14, 2020, at 9:59 AM, Dave <dave@looktowindward.com> wrote:

Mac Project.
MacOS 10.14.6

Hi All,

I have some code that needs to be initialized before any Window/View are displayed. The App was working ok, but it looks like something has changed?

I have a call to initialise AppDelegate:applicationDidFinishLaunching BUT, the Initial Window/View Controller viewDidAppear method is being called before applicationDidFinishLaunching. Is this correct behaviour and if so where is the best place to initialise things?

Thanks a lot
All the Best
Dave






Re: When does AppDelegate:applicationDidFinishLaunching get called?

Sandor Szatmari
 

-(void)awakeFromNib might work for you.

Sandor

On Jan 14, 2020, at 11:13, Dave <dave@looktowindward.com> wrote:

Mac Project.
MacOS 10.14.6

Hi All,

I have some code that needs to be initialized before any Window/View are displayed. The App was working ok, but it looks like something has changed?

I have a call to initialise AppDelegate:applicationDidFinishLaunching BUT, the Initial Window/View Controller viewDidAppear method is being called before applicationDidFinishLaunching. Is this correct behaviour and if so where is the best place to initialise things?

Thanks a lot
All the Best
Dave




Re: When does AppDelegate:applicationDidFinishLaunching get called?

Alex Zavatone
 

You can also look at other methods in the AppDelegate, such as init, applicationWillFinishLaunchingWithOptions and so on.

Just look at the header. They are easy to try.

On Jan 14, 2020, at 9:59 AM, Dave <dave@looktowindward.com> wrote:

Mac Project.
MacOS 10.14.6

Hi All,

I have some code that needs to be initialized before any Window/View are displayed. The App was working ok, but it looks like something has changed?

I have a call to initialise AppDelegate:applicationDidFinishLaunching BUT, the Initial Window/View Controller viewDidAppear method is being called before applicationDidFinishLaunching. Is this correct behaviour and if so where is the best place to initialise things?

Thanks a lot
All the Best
Dave




When does AppDelegate:applicationDidFinishLaunching get called?

Dave
 

Mac Project.
MacOS 10.14.6

Hi All,

I have some code that needs to be initialized before any Window/View are displayed. The App was working ok, but it looks like something has changed?

I have a call to initialise AppDelegate:applicationDidFinishLaunching BUT, the Initial Window/View Controller viewDidAppear method is being called before applicationDidFinishLaunching. Is this correct behaviour and if so where is the best place to initialise things?

Thanks a lot
All the Best
Dave


Flipped Views not Appearing Correctly when Loaded from Storyboard

Dave
 

Hi All,

I am using Flipped Views (isFlipped = YES) in a window. The window is loaded from a Storyboard file. Initially the window appears Bottom Up instead of Top Down. When I resize the window all Snaps into place ok. How can I get the window to display correctly when first loaded from a Storyboard file?

Thanks a lot
All the Best
Dave


Re: [OT] Cocoa Developer Needed

Dave
 

On 13 Dec 2019, at 01:24, Sandor Szatmari <admin.szatmari.net@gmail.com> wrote:


I’m looking for a macOS developer to join our team in Northern NJ. This is for mid-level candidates or higher.

Candidates must be well versed or fluent in the following:
Objective-C/C
SQL (preferably Postgres)
GIT/SVN
Shell scripting (Bash)

Some Experience:
DocBook
XML
32 -> 64 bit conversion
MRC -> ARC

Additional skills:
4D
Java

Local candidates preferred, but remote work from home is not out of the question. We are not offering relocation.

Please contact me directly for more details.

Thanks,
Sandor


How to Initial Views using Manual Layout?

Dave
 

XCode 11
Mac

Hi,

I have the following view hierarchy in a Storyboard file

Window->RootView-BottomView->BoardView->CellView1
Window->RootView-BottomView->BoardView->CellView2
Window->RootView-BottomView->BoardView->CellView3
…..
…..
Window->RootView-BottomView->BoardView->CellView81

I’m laying out the view manually because it is so much easier than using Auto Layout and I had no luck on making it work anyway.

I’m overriding in all classes:

-(void) resizeWithOldSuperviewSize:(NSSize) theOldSuperViewSize

Which handles the resizing.


However when the Window/WindowController is first display from the storyboard the View Hierarchy is not initialised and the Initial view window content is as it was in the Storyboard file (all over the place!), Also I’m using “Flipped” coordinates (isFlipped = YES) and so it appears bottom up instead of top down.

If I resize the window, everything snaps into place nicely! How can I initialise the View System so that it appears ok when the Window it first displayed?

Thanks a lot for any help.
All the Best
Dave


Silencing deprecation warnings in Swift

Steve Christensen
 

I’m in the process of porting some Obj-C code to Swift. Several Core Data entity properties are marked as deprecated for general use but, at least in several migration methods, they still need to be accessed legitimately.

With Obj-C the code in specific methods is bracketed with #pragmas where the deprecated properties are accessed:

- (void) MigrateFoo
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations”

// touch deprecated properties

#pragma clang diagnostic pop
}

Note that I do not want the warnings silenced project-wide nor, ideally, for an entire source file.

Is there a way of doing this when compiling Swift? Older posts on stackoverflow, etc., mention that it wasn’t doable at the time, but I haven’t seen more recent mentions either way.

Thanks,
Steve


Specializing NSPredicateEditor

Steve Mills
 

Can anyone think of a way to subclass NSPredicateEditor so a shift-click in the + button will cause the same template as the clicked row to be inserted instead of the next unused template? If there are multiple templates, the default behavior will add each one in sequence. Most of the time I want to add multiples of the same criteria type, e.g. “keyword is blah” and “keyword is gort”. Having to always change the criteria type after clicking + is bothersome.

Steve via iPhone


Where is my crash log?

Gerriet M. Denkmann
 

Console.app told me:
default 22:57:28.157905+0700 ReportCrash Saved crash report for chronyd[15863] version 0 to chronyd_2019-12-14-225728_Spinat.crash

But I cannot find this.
Where should I look?

Gerriet.


[OT] Cocoa Developer Needed

Sandor Szatmari
 

I’m looking for a macOS developer to join our team in Northern NJ. This is for mid-level candidates or higher.

Candidates must be well versed or fluent in the following:
Objective-C/C
SQL (preferably Postgres)
GIT/SVN
Shell scripting (Bash)

Some Experience:
DocBook
XML
32 -> 64 bit conversion
MRC -> ARC

Additional skills:
4D
Java

Local candidates preferred, but remote work from home is not out of the question. We are not offering relocation.

Please contact me directly for more details:

opportunity [at] infoplusonline [dot] com

Thanks,
Sandor


Re: Drag & Drop, a lifelong curse

Steve Mills
 

On Dec 12, 2019, at 16:23:46, Shane Stanley <sstanley@myriad-com.com.au> wrote:

On 13 Dec 2019, at 1:17 am, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

Does that give you the multiple images thing where different destinations can rearrange the images in stacks, grids, or whatever?
I suspect you can answer that quicker than me.
I just thought you might know. It's too complex for me to rejigger it all just to find that answer, and I have it working now, so I don't care. :)

--
Steve Mills
Drummer, Mac geek


[OT] Cocoa Developer Needed

Sandor Szatmari
 

I’m looking for a macOS developer to join our team in Northern NJ. This is for mid-level candidates or higher.

Candidates must be well versed or fluent in the following:
Objective-C/C
SQL (preferably Postgres)
GIT/SVN
Shell scripting (Bash)

Some Experience:
DocBook
XML
32 -> 64 bit conversion
MRC -> ARC

Additional skills:
4D
Java

Local candidates preferred, but remote work from home is not out of the question. We are not offering relocation.

Please contact me directly for more details.

Thanks,
Sandor


Re: Drag & Drop, a lifelong curse

Shane Stanley
 

On 13 Dec 2019, at 1:17 am, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

Does that give you the multiple images thing where different destinations can rearrange the images in stacks, grids, or whatever?
I suspect you can answer that quicker than me.

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


Re: Drag & Drop, a lifelong curse

Steve Mills
 

On Dec 12, 2019, at 05:46:27, Shane Stanley <sstanley@myriad-com.com.au> wrote:

On 12 Dec 2019, at 9:25 am, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

So does dragging files from one app to another need some other flavor added?
Maybe I'm missing something, but can't you just use this:

[[NSPasteboard generalPasteboard] clearContents];
[[NSPasteboard generalPasteboard] writeObjects:@[url]];
Does that give you the multiple images thing where different destinations can rearrange the images in stacks, grids, or whatever? My drag source is a collection view or a table view, so the initial drag image[s] is a carbon copy of the selected items' thumbnails or table rows.

--
Steve Mills
Drummer, Mac geek


Re: Drag & Drop, a lifelong curse

Shane Stanley
 

On 12 Dec 2019, at 9:25 am, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

So does dragging files from one app to another need some other flavor added?
Maybe I'm missing something, but can't you just use this:

[[NSPasteboard generalPasteboard] clearContents];
[[NSPasteboard generalPasteboard] writeObjects:@[url]];

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


Re: Drag & Drop, a lifelong curse

Steve Mills
 

After just trying all kinds of random crap, I got it to work. Turns out, if you call [url pasteboardPropertyListForType:NSPasteboardTypeFileURL], you can't use that with [pbItem setPropertyList:thing forType:NSPasteboardTypeFileURL]. I don't see anything in the docs that says you can't. You ask for a propertyList, so you assume you can use it as a propertyList with another method that has propertyList in the name. Nope, I guess logic was optional the day they invented this part of NSPasteboard and NSPasteboardItem. The docs mention that "the pasteboard will automatically convert these items to the correct data format required for the pasteboard", which makes it sound like it will just work with -setPropertyList:forType:. Nope.

Instead, I had to do this:

NSPasteboardItem* result = [NSPasteboardItem new];
NSString* urlType;

if(@available(macOS 10.13, *))
urlType = NSPasteboardTypeFileURL;
else
urlType = NSURLPboardType;

id probablyAStringMaybeData = [url pasteboardPropertyListForType:urlType];

if([probablyAStringMaybeData isKindOfClass:[NSString class]])
[result setString:probablyAStringMaybeData forType:urlType];
else if([probablyAStringMaybeData isKindOfClass:[NSData class]])
[result setData:probablyAStringMaybeData forType:urlType];
else
[result setPropertyList:probablyAStringMaybeData forType:urlType];

--
Steve Mills
Drummer, Mac geek


Drag & Drop, a lifelong curse

Steve Mills
 

OK, so after "modernizing" my app to add multiple drag items (flavor NSPasteboardTypeFileURL) to the drag clipboard instead of just one with multiple flavors (NSFilenamesPboardType and NSURLPboardType), it's come to my attention that files can no longer be dragged from my app to any other app, e.g., dragging to an app in the Dock results in nothing.

I see this in Xcode's console for each item when I call beginDraggingSessionWithItems:event:source:

Sandbox extension data required immediately for flavor public.file-url, but failed to obtain.

The app is sandboxed, has entitlements for com.apple.security.files.bookmarks-app-scope and com.apple.security.files.user-selected.read-write. Folders urls are granted permission by the user, then urls for individual files within those folders can be added to the drag.

So does dragging files from one app to another need some other flavor added? If so, how do I add additional flavors when using the multiple-item scheme instead of using a single drag image with multiple flavors?

I swear, D&D (and pasteboards in general) is always the most complicated thing, no matter how many changes Apple has put it through.

--
Steve Mills
Drummer, Mac geek


Re: How to return data for NXSMLParserDelegate's -parser:resolveExternalEntityName:systemID:

Steve Mills
 

On Dec 11, 2019, at 12:21:27, Keary Suska <cocoa-dev@esoteritech.com> wrote:

IRC, NSXMLParser is pretty vanilla, and back in the day it was recommended to use an xml parsing library directly rather than NSXMLParser if you have to work with anything except basic XML. Does not seem like Apple has improved it since then. That being said, technically, there are only a small set of “standard” entities: &lt;, &gt;, &apos;, &quot; and &amp;. All other entities must be declared.

FWIW, the commonly accepted solution seems to be to pre-convert entities before passing passing to NSXMLParser. As long as the result is valid utf-8, it won’t choke the parser.

The most comprehensive discussion I could find was this one: https://stackoverflow.com/questions/2370842/resolving-html-entities-with-nsxmlparser-on-iphone which may or may not have an alternative solution.
Thanks for this. I ended up pre- and post-processing entities that aren't normally handled by the parser or the delegate in other places, because I simply want them to persist. Yeah, NSXMLParser and friends are pretty lame when it comes down to doing anything not involving elements and plain text.

--
Steve Mills
Drummer, Mac geek

281 - 300 of 1426