Date   

SplitViewController with 3 Columns - What am I missing??

Rick Aurbach
 

Xcode 13ß1, deploying to iOS 15, UIKit using Storyboards.
 
I have a tab bar controller which (for one of its tabs) contains a split view controller. The split view controller is configured in the storyboard as:
 
Style: Triple Column
Compact Wide: Use Separate View Controller - NO
Present Master With Gesture - YES
Display Mode: Two Columns Beside
Behavior: Tile
Primary Edge: Leading
 
I have triggered segues to the three (primary, secondary, and supplemental) view controllers set up in the storyboard.
 
The split view controller has a delegate which implements splitViewController(_: topColumnForCollapsingToProposedTopColumn:) to return .primary. Moreover, the split view controller's viewDidLoad() method reiterates the basic settings:
presentsWithGesture = true
preferredDisplayMode = .twoBesideSecondary
preferredSplitBehavior = .tile
 
With the Simulator set up to use an iPad in landscape mode, running the app shows ONLY the primary column. I do NOT get the "two columns beside" display mode.
 
Obviously I am missing something obvious, but I just can't see it. What am I missing and/or doing wrong?
 


Re: Adding multiple shadows to a UIView in either Objective-C or Swift

Alex Zavatone
 

Well, it sure is an important detail.  If no color is added or if you use a clear color, you get no shadow.  

I did find a sort of a solution though and this works as long as you don’t have a transparency on the image.  

Duplicate the CALayer.

But that’s the problem?  How? 

Through NSKeyedArchiver or CAReplicatorLayer.

CALayer *layer1;
CALayer *layer2;

// Set up layer1's specifics.

layer2 = [NSKeyedUnarchiver unarchivedObjectOfClass:[CALayer class]
                                                            fromData:[NSKeyedArchiver archivedDataWithRootObject:layer1 requiringSecureCoding:NO error:nil] error:nil];

Two shadows on one UIView with 2 layers.  Testing now with PNG and SVG images.

This also works.

Cheers and if anyone wants the code when I’m done, I’ll happily share it.

Alex Zavatone



On Jun 16, 2021, at 10:40 AM, Carl Hoefs <newslists@...> wrote:

In past code, I've used the behavior that layers will render a shadow whose strength is in accord with the opacity of the fill color. 0 opacity (clearColor) gives no shadow at all.

I think you may be fighting the frameworks here...

-Carl


On Jun 16, 2021, at 8:33 AM, Alex Zavatone via groups.io <zav@...> wrote:

Apparently, layers do now render shadows at all if the layer is of clearColor.









Re: Adding multiple shadows to a UIView in either Objective-C or Swift

Carl Hoefs
 

In past code, I've used the behavior that layers will render a shadow whose strength is in accord with the opacity of the fill color. 0 opacity (clearColor) gives no shadow at all.

I think you may be fighting the frameworks here...

-Carl

On Jun 16, 2021, at 8:33 AM, Alex Zavatone via groups.io <zav=mac.com@groups.io> wrote:

Apparently, layers do now render shadows at all if the layer is of clearColor.


Re: Adding multiple shadows to a UIView in either Objective-C or Swift

Alex Zavatone
 

Apparently, layers do now render shadows at all if the layer is of clearColor.

There is a second layer in the image below, but no shadow.


Now, how to work around that?


On Jun 16, 2021, at 9:46 AM, Alex Zavatone via groups.io <zav@...> wrote:

Has any one of of us successfully done this?  We’ve been trying to do this with CALayers for days now and it’s been monumentally unsuccessful.

Either we get one shadow on one layer and no shadows on any other added layer or no shadows at all.  I’ll gladly post code, but we’ve been at this for way too long and with too many iterations.  

We’ve been inserting and adding layers and it’s pretty odd just how this goes to extreme efforts not to produce any additional shadows.

Also, when inserting a CALayer at an index, the docs are really good at not stating what the layer stands for.  Is it a Z-order?  What does position 0 represent?  Frontmost?  Bottom?  Nothing related to the above?

Thanks in advance.  I’ve done this in Obj-C and Swift it’s amazing how hard it is to get a second layer to not replace the previous one and to get a shadow on both.  

Here’s some Obj-C code that I am using to set a shadow.

If I take that code below and change it to add a shadow to a layer and return the layer, then insert or add it to the view, we get nothing but the code below works fine on its own.  

alpha = 0.4;
    x = 0;
    y = 8.0;
    blur = 10.0;
    spread = 10.0; // 1
    
    [self.box2 addShadowToView:color alpha:alpha x:x y:y blur:blur spread:spread];

——––––

- (UIView *)addShadowToView:(UIColor *)color
                  alpha:(CGFloat)alpha
                      x:(CGFloat)x
                      y:(CGFloat)y
                   blur:(CGFloat)blur
                 spread:(CGFloat)spread
{
    
    self.layer.masksToBounds = NO;
    self.layer.needsDisplayOnBoundsChange = YES;
    self.layer.shouldRasterize = YES;
    self.layer.shadowColor = color.CGColor;
    self.layer.shadowOpacity = alpha;
    self.layer.shadowOffset = CGSizeMake(x, y);
    self.layer.shadowRadius = blur / 2 ; //UIScreen.mainScreen.scale;
    if (spread == 0) {
        self.layer.shadowPath = nil;
    } else {
        CGFloat deltaX = spread;
        CGRect shadowRect = CGRectInset(self.bounds, deltaX, deltaX);
        self.layer.shadowPath = CFBridgingRetain([UIBezierPath bezierPathWithRect: shadowRect]);
    }
    
    return self;
}








Adding multiple shadows to a UIView in either Objective-C or Swift

Alex Zavatone
 

Has any one of of us successfully done this?  We’ve been trying to do this with CALayers for days now and it’s been monumentally unsuccessful.

Either we get one shadow on one layer and no shadows on any other added layer or no shadows at all.  I’ll gladly post code, but we’ve been at this for way too long and with too many iterations.  

We’ve been inserting and adding layers and it’s pretty odd just how this goes to extreme efforts not to produce any additional shadows.

Also, when inserting a CALayer at an index, the docs are really good at not stating what the layer stands for.  Is it a Z-order?  What does position 0 represent?  Frontmost?  Bottom?  Nothing related to the above?

Thanks in advance.  I’ve done this in Obj-C and Swift it’s amazing how hard it is to get a second layer to not replace the previous one and to get a shadow on both.  

Here’s some Obj-C code that I am using to set a shadow.

If I take that code below and change it to add a shadow to a layer and return the layer, then insert or add it to the view, we get nothing but the code below works fine on its own.  

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

    

    [self.box2 addShadowToView:color alpha:alpha x:x y:y blur:blur spread:spread];

——––––

- (UIView *)addShadowToView:(UIColor *)color
                  alpha:(CGFloat)alpha
                      x:(CGFloat)x
                      y:(CGFloat)y
                   blur:(CGFloat)blur
                 spread:(CGFloat)spread
{

    

    self.layer.masksToBounds = NO;
    self.layer.needsDisplayOnBoundsChange = YES;
    self.layer.shouldRasterize = YES;
    self.layer.shadowColor = color.CGColor;
    self.layer.shadowOpacity = alpha;
    self.layer.shadowOffset = CGSizeMake(x, y);
    self.layer.shadowRadius = blur / 2 ; //UIScreen.mainScreen.scale;
    if (spread == 0) {
        self.layer.shadowPath = nil;
    } else {
        CGFloat deltaX = spread;
        CGRect shadowRect = CGRectInset(self.bounds, deltaX, deltaX);
        self.layer.shadowPath = CFBridgingRetain([UIBezierPath bezierPathWithRect: shadowRect]);
    }

    

    return self;
}







Network Server Shares

Sandor Szatmari
 

Did Apple kill access to /Network/Applications and /Network/Library shares published from macos server?

Testing Mojave (yes this is old stuff) and I don’t see these shares that are published from out OpenDirectory server.

Thanks,
Sandor


Re: Exception not being caught in try statement

Mark Allan
 

Hi all,

Thanks to everyone for their suggestions. I spent far too much time working around this bug, but have finally got to the bottom of the original issue.

It turns out this is a known issue with some other apps as well, and (thanks to https://trac.cyberduck.io/ticket/11231#comment:25 ) can be fixed by removing an obscure preference key from the User Defaults system.

I was able to reproduce the issue by setting the __NSDisableSharingTextTabInstance key to YES using the "defaults write" command.

I've solved it by removing that key in my -applicationDidFinishLaunching method:
[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"__NSDisableSharingTextTabInstance"];

Looks like someone has already submitted a bug report to Apple for it (https://openradar.appspot.com/FB8930278 ) so I'm just posting this here in case it helps anyone else in the future.

Best regards,
Mark 

On 29 Mar 2021, at 7:01 pm, Martin Wierschin via Cocoa-dev <cocoa-dev@...> wrote:

Breaking the RTFD loading process down into subtasks is a good idea. It might be worth trying to sidestep the issue using NSAttributedString. You can try loading the data yourself as Mike suggested and then use initWithRTFD or initWithRTFDFileWrapper. Once you have the text in an attributed string you can swap its content into your NSTextView/NSTextStorage using -replaceCharactersInRange:withAttributedString:

However, I suspect the problem will remain. The exception is coming from Apple's internal NSRTFReader class, which we can be reasonably certain is utilized by all RTF/RTFD loading code paths. To really fix this you're probably going to be stuck with ugly code that either:

1. Preprocess the RTFD to remove the data that Apple's code can't handle, eg: strip tab stops as someone else suggested.
2. Use method swizzling to patch Apple's buggy methods at runtime, eg: replace -[NSRTFReader defaultParagraphStyle] to avert the conditions that lead to the exception, before it gets thrown in the first place.

One other potential debugging aid: NSExceptionHandler. You can register your own handler, perhaps in a way that prevents AppKit from killing your app outright when an exception occurs (this used to be possible but I don't know the current behavior). But as Mike said, this isn't a real solution for shipping software. Generally speaking once an app has thrown an exception its state can't be relied upon. So you should only use this for testing to gather additional debug information.

~Martin Wierschin

On Mar 26, 2021, at 11:22 AM, Mike Abdullah via Cocoa-dev <cocoa-dev@...> wrote:

This does seem quite surprising. However, here’s the thing: this code is very strange approach to take.

Number 1: Cocoa doesn’t support exceptions as an error-handling mechanism except where explicitly stated and supported. You’re trying to use them, which is asking for trouble. The system doesn’t guarantee proper handling of memory if an exception does throw.

Number 2: Your error handling approach is back-to-front. You’re trying an operation, seeing if it fails, then attempting to guess from the current state (which might have changed in the meantime) why it might have failed.

Instead, use the proper error APIs and approach:

1. Load the data from disk, e.g. +[NSData dataWithContentsOfURL:options:error:]

If that fails you can introspect the error to your heart’s content to find out what went wrong

2. Load the data into your text view. I’m not sure if there’s an API to do that in a single step or not, dunno.

I also note that your code explicitly is trying to read an RTFD which if memory serves can be a document *bundle* format, so perhaps at step 1 you’d have to go with a file wrapper. But the path you specify is .rtf so I’m guessing you really do have a basic file and can load it as data.

Mike.

On 26 Mar 2021, at 11:11, Mark Allan via Cocoa-dev <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 0x600000634540
*** 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                      0x00007fff206ea6af __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007fff204223c9 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff2079ea9a -[__NSCFString characterAtIndex:].cold.1 + 0
3   CoreFoundation                      0x00007fff2079c953 -[__NSArrayM insertObject:atIndex:].cold.2 + 0
4   CoreFoundation                      0x00007fff20610421 -[__NSArrayM insertObject:atIndex:] + 1135
5   UIFoundation                        0x00007fff23c223ab __defaultTabStops_block_invoke + 161
6   libdispatch.dylib                   0x00007fff203cd7c7 _dispatch_client_callout + 8
7   libdispatch.dylib                   0x00007fff203ce96b _dispatch_once_callout + 20
8   UIFoundation                        0x00007fff23c229d7 -[NSMutableParagraphStyle setTabStops:] + 199
9   UIFoundation                        0x00007fff23c3c697 -[NSRTFReader defaultParagraphStyle] + 75
10  UIFoundation                        0x00007fff23c3c5be -[NSRTFReader _mutableParagraphStyle] + 112
11  UIFoundation                        0x00007fff23c36113 controlClass + 1757
12  UIFoundation                        0x00007fff23c356b4 -[NSRTFReader attributedString] + 76
13  UIFoundation                        0x00007fff23c311a6 _NSReadAttributedStringFromURLOrData + 3213
14  UIFoundation                        0x00007fff23d46985 -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithURL:options:documentAttributes:error:] + 228
15  AppKit                              0x00007fff23677d9a -[NSTextView readRTFDFromFile:] + 126
16  MyAppHere                             0x0000000105fa18a7 MyAppHere+ 227495
17  AppKit                              0x00007fff230af7fd -[NSApplication(NSResponder) sendAction:to:from:] + 283
18  AppKit                              0x00007fff231b2611 -[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


Re: What is the best strategy for this?

Ben Kennedy
 


On 3 Apr 2021, at 8:46 am, Ben Kennedy <ben-groups@...> wrote:

On Apr 3, 2021, at 8:04 AM, Rick Aurbach via groups.io <rlaurb@...> wrote:

Each of these objects is a cell in a UICollectionView (with a custom Layout). I rather fear that without overriding pieces of touch processing, the collection view will not treat the rotated cell geometry properly.

Yes, so why not transform the collection view as a whole (not the cells)?

This piqued my curiosity, so I couldn't help myself and built a test case. This seems to work perfectly -- and no collection view required. The code is short enough that I've copy/pasted it all below.

-ben


class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let dimension = 4
        let spacing = CGFloat(2.0)
        
        let containerStackView = UIStackView()
        containerStackView.axis = .vertical
        containerStackView.spacing = spacing
        containerStackView.alignment = .center
        containerStackView.distribution = .equalSpacing
        containerStackView.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(containerStackView)
        NSLayoutConstraint.activate([
            containerStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            containerStackView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
        ])
        
        for y in 1...(dimension * 2) {
            let rowStackView = UIStackView()
            rowStackView.axis = .horizontal
            rowStackView.spacing = spacing
            rowStackView.alignment = .center
            rowStackView.distribution = .equalSpacing
            rowStackView.translatesAutoresizingMaskIntoConstraints = false
            containerStackView.addArrangedSubview(rowStackView)
            
            for _ in 1...(y <= dimension ? y * 2 - 1 : (dimension * 2 - y + 1) * 2 - 1) {
                let cubbyHoleView = CubbyHoleView()
                cubbyHoleView.translatesAutoresizingMaskIntoConstraints = false
                rowStackView.addArrangedSubview(cubbyHoleView)
                NSLayoutConstraint.activate([
                    cubbyHoleView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.5 / CGFloat(dimension)),
                    cubbyHoleView.heightAnchor.constraint(equalTo: cubbyHoleView.widthAnchor)
                ])
            }
        }
        
        containerStackView.transform = CGAffineTransform.init(rotationAngle: -45.0 * CGFloat.pi / 180.0)
    }
}

class CubbyHoleView: UIView {
    let defaultBackgroundColor = UIColor.systemBlue.withAlphaComponent(0.1)
    init() {
        super.init(frame: .zero)
        backgroundColor = defaultBackgroundColor
        layer.borderColor = UIColor.black.cgColor
        layer.borderWidth = 2.0
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        backgroundColor = .systemYellow
    }
    
    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        backgroundColor = defaultBackgroundColor
    }
}




Re: What is the best strategy for this?

Ben Kennedy
 

On Apr 3, 2021, at 8:04 AM, Rick Aurbach via groups.io <rlaurb=me.com@groups.io> wrote:

Each of these objects is a cell in a UICollectionView (with a custom Layout). I rather fear that without overriding pieces of touch processing, the collection view will not treat the rotated cell geometry properly.
Yes, so why not transform the collection view as a whole (not the cells)?

-ben


Re: What is the best strategy for this?

Alex Zavatone
 

It would be interesting to try out.  Try removing the spaces between each cell and issue the rotation, then try it out and find out.

Alex Zavatone

On Apr 3, 2021, at 10:04 AM, Rick Aurbach via groups.io <rlaurb@...> wrote:

It's an interesting idea, but there's an added complication (which I apologize for not making explicit in the original post) which makes this problematic. Each of these objects is a cell in a UICollectionView (with a custom Layout). I rather fear that without overriding pieces of touch processing, the collection view will not treat the rotated cell geometry properly.

Another way of thinking of this problem is as trying to create a non-rectangular collection-view cell which responds based on its shape, not its bounding box.


Re: What is the best strategy for this?

Rick Aurbach
 

It's an interesting idea, but there's an added complication (which I apologize for not making explicit in the original post) which makes this problematic. Each of these objects is a cell in a UICollectionView (with a custom Layout). I rather fear that without overriding pieces of touch processing, the collection view will not treat the rotated cell geometry properly.

Another way of thinking of this problem is as trying to create a non-rectangular collection-view cell which responds based on its shape, not its bounding box.


Re: What is the best strategy for this?

Ben Kennedy
 

On 2 Apr 2021, at 3:27 pm, Rick Aurbach via groups.io <rlaurb=me.com@groups.io> wrote:

Consider a square cell which contains a diamond. The four vertices of the diamond are the midpoints of the four sides of the cell. The active region of each cell is the area inside the diamond. Cells are close-packed horizontally. Each section (i.e., "row") is offset a half-width down and a half-width to the side of the cells above it. In other words, the cells are positioned so that the diamond edges are superimposed. The attached image should give you an idea.
Perhaps this is naïve, but the first thing that comes to mind: could you not simply deal with it as a regular matrix of squares, and then apply a 45 degree transform on the view?

(I haven't tested anything like this, but I presume that touch events would be transformed accordingly…?)

-ben


What is the best strategy for this?

Rick Aurbach
 

Problem: I am designing a collection view with overlapping cells. Each cell has an active area inside it (and the active areas of adjacent cells do not overlap). (More information about what I'm doing at the bottom of this post.) I want a tap in the active area of a cell to select that cell, but a tap outside the active area of any cell should deselect the currently selected cell [single selection only; I don't need to support multi-selection at this point].

My original thought was to override the collection view's indexPathForItem(at:) and either the cell's touch event handlers or UICollectionView's touch event handlers. But, to make this work, I also need to know something about HOW the touch event handler interact with the UICollectionView. (This might be as simple as having touchesEnded(_:with:) call selectItem(at:animated:scrollPosition:) and deselectItem(at:animated:). Or?)

Before I start possibly reinventing the wheel here, I'd like to ask if anyone has done anything similar and has any ideas to share.

Thanks,

Rick

-------------------------
Consider a square cell which contains a diamond. The four vertices of the diamond are the midpoints of the four sides of the cell. The active region of each cell is the area inside the diamond. Cells are close-packed horizontally. Each section (i.e., "row") is offset a half-width down and a half-width to the side of the cells above it. In other words, the cells are positioned so that the diamond edges are superimposed. The attached image should give you an idea.


Re: Compiler error - method not found on object which conforms to protocol

Sandor Szatmari
 

Alex,

Thanks for your input.

On Mar 30, 2021, at 10:13, Alex Zavatone via groups.io <zav@...> wrote:

Hi.  I’m late to the discussion, but have you put the property or method on the class?
Yes, the conforming class did have the method/property implemented.  

When you have a class that conforms to a protocol, my understanding is that you cross your heart and swear to die that you will make sure that the class doing the conforming will implement those methods/properties.  
Yes the compiler warns if the conforming class does not fully implement the protocol.  And of course there are required and optional aspects to a protocol. The compiler only warns about required elements that are missing.


I’m not sure if this would work with inherited methods or properties as I’ve never tried it.

Now, if a method missing for a property (if it is implemented), I’d expect it would be accessor methods.  If your conforming class has the property declared, try creating the set and bet methods.  If the property isn’t declared, try declaring it and I’d expect Objectice-C to auto declare the accessors.  If it doesn’t, then add them to see if the error goes away.

I had all the pieces in place except for the import to inform the compiler of the methods declared in the protocol.  The forward declaration in the header slightly masked the issue so that I didn’t recognize why the error was being generated. 

The object was already declared as conformant

@property (readonly) id<DataSrcProto> dataSource;

But, without the actual import in the scope of the compilation unit, the compiler had no idea what methods were actually declared in the protocol.

Thanks,
Sandor

Best of luck,
Alex Zavatone

On Mar 27, 2021, at 8:54 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

Thanks Sak,

On Mar 27, 2021, at 04:54, Sak Wathanasin <sw@...> wrote:

On 27 Mar 2021, at 01:41, Sandor Szatmari <admin.szatmari.net@...> wrote:
@protocol dataSrcProto
-(NSUinteger)serverPort;
@end

serverPort isn't a property, so you have to use

This is how I’m working around the error right now.  Like this I get a compiler warning, method not found, return type defaults to id.  
[self.dataSource serverPort];


Port = (NSUInteger)[self.dataSource serverPort];

This succeeds at runtime, but of course smells, and doesn’t squelch the warning.

If you want it to be a property, make it so

I tried implementing serverPort as a property and I still get the same error

Thanks,
Sandor


@protocol dataSrcProto
@property (readonly) NSUinteger serverPort;
@end

Regards
Sak


Re: Compiler error - method not found on object which conforms to protocol

Alex Zavatone
 

Hi.  I’m late to the discussion, but have you put the property or method on the class?

When you have a class that conforms to a protocol, my understanding is that you cross your heart and swear to die that you will make sure that the class doing the conforming will implement those methods/properties.  

I’m not sure if this would work with inherited methods or properties as I’ve never tried it.

Now, if a method missing for a property (if it is implemented), I’d expect it would be accessor methods.  If your conforming class has the property declared, try creating the set and bet methods.  If the property isn’t declared, try declaring it and I’d expect Objectice-C to auto declare the accessors.  If it doesn’t, then add them to see if the error goes away.

Best of luck,
Alex Zavatone

On Mar 27, 2021, at 8:54 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

Thanks Sak,

On Mar 27, 2021, at 04:54, Sak Wathanasin <sw@...> wrote:

On 27 Mar 2021, at 01:41, Sandor Szatmari <admin.szatmari.net@...> wrote:
@protocol dataSrcProto
-(NSUinteger)serverPort;
@end

serverPort isn't a property, so you have to use

This is how I’m working around the error right now.  Like this I get a compiler warning, method not found, return type defaults to id.  
[self.dataSource serverPort];


Port = (NSUInteger)[self.dataSource serverPort];

This succeeds at runtime, but of course smells, and doesn’t squelch the warning.

If you want it to be a property, make it so

I tried implementing serverPort as a property and I still get the same error

Thanks,
Sandor


@protocol dataSrcProto
@property (readonly) NSUinteger serverPort;
@end

Regards
Sak


Re: Compiler error - method not found on object which conforms to protocol

Sandor Szatmari
 

Thanks for everyone’s help and I’m sorry I was unable to share the code.  I’m sure it would have been obvious and everyone would have see the issue with the actual code available.

It turns out that I only had a forward declaration of the protocol in the header, once I added an actual import of the protocol to the ‘.m’ file, the error was resolved.  

Thanks again for everyone’s thoughts!

Sandor

On Mar 27, 2021, at 12:39, Sak Wathanasin <sw@...> wrote:



On 27 Mar 2021, at 13:54, Sandor Szatmari <admin.szatmari.net@...> wrote:

I tried implementing serverPort as a property and I still get the same error


As Allan suggested, maybe you should post the actual code. I have this same usage in my code and it builds & runs just fine.

Regards
Sak


Re: Compiler error - method not found on object which conforms to protocol

Sak Wathanasin
 



On 27 Mar 2021, at 13:54, Sandor Szatmari <admin.szatmari.net@...> wrote:

I tried implementing serverPort as a property and I still get the same error


As Allan suggested, maybe you should post the actual code. I have this same usage in my code and it builds & runs just fine.

Regards
Sak


Re: Trouble with NSTableViews in macOS 11.x

Sak Wathanasin
 



On 26 Mar 2021, at 22:46, Jon Gotow <gotow@...> wrote:

I ran into this when updating all of my apps for Big Sur. You'd think the "Full Width" style would make the table, well, full width, but it doesn't. I think the solution was to set the tableview style to "Plain". 

Both "plain" and "fullwidth" sort of work; my mistake was using IB to set this property and it had no effect. When I set it in code (thanks, Shane!), I could see differences in behaviour. Both styles result in the gridlines being drawn from edge to edge. However,

1) with "fullwidth"
- the table is still indented (6 or 16 px as before)
- if the enclosing scrollview has borders, gridlines are drawn for empty rows
- if the scrollview has no borders, gridlines are not drawn for empty rows

2) with "plain"
- the table is no longer indented
- gridlines are not drawn for empty rows whether the scrollview has borders or not

We want gridlines on empty rows, but our tables are also borderless as the designers wanted the border around the table name label as well. Bascially, we want the 10.15 behaviour back. That it behaves differently depending on whether the enclosing scrollview is bordered or not doesn't feel right.

I guess it's worth raising a bug report with Apple and seeing what comes of it.

Thanks to everyone
Sak


Re: Compiler error - method not found on object which conforms to protocol

Allan Odgaard <groups-io@...>
 

On 27 Mar 2021, at 2:41, Sandor Szatmari wrote:

[…] This is outlined in pseudocode below.

There is nothing conceptually wrong with what you sketch in your pseudo-code.

Please post an actual runnable example, as your pseudo-code has typos and lack context, something like the below compiles (and runs) just fine:

@protocol dataSrcProto
- (NSUInteger)serverPort;
@end

@interface MyDataSource : NSObject <dataSrcProto>
@end

@implementation MyDataSource
- (NSUInteger)serverPort { return 8000; }
@end

int main (int argc, char const* argv[])
{
    id <dataSrcProto> server; // obtained from seomewhere
    fprintf(stderr, "%ld\n", server.serverPort);
    return 0;
}


Re: Compiler error - method not found on object which conforms to protocol

Sandor Szatmari
 

Thanks Sak,

On Mar 27, 2021, at 04:54, Sak Wathanasin <sw@...> wrote:

On 27 Mar 2021, at 01:41, Sandor Szatmari <admin.szatmari.net@...> wrote:
@protocol dataSrcProto
-(NSUinteger)serverPort;
@end

serverPort isn't a property, so you have to use

This is how I’m working around the error right now.  Like this I get a compiler warning, method not found, return type defaults to id.  
[self.dataSource serverPort];


Port = (NSUInteger)[self.dataSource serverPort];

This succeeds at runtime, but of course smells, and doesn’t squelch the warning.

If you want it to be a property, make it so

I tried implementing serverPort as a property and I still get the same error

Thanks,
Sandor


@protocol dataSrcProto
@property (readonly) NSUinteger serverPort;
@end

Regards
Sak

41 - 60 of 1423