0

This may be an AppCode question, since Xcode doesn't mark this particular scenario.

I see this error in various places in AppCode:

Parameter type mismatch: Types 'nullable' and 'FooType' are not compatible

where FooType can be any type.

Here's a call that demonstrates the issue:

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:spinnerBackgroundView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 constant:0]];

where the toItem value gets tagged with the warning.

Looking at the API, the toItem parameter is nullable:

+(instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c;

Is this being caused by how I'm calling the API? Or is it a glitch in AppCode (which doesn't offer any suggestions beyond "switch to getter mode" which makes no difference.)

David Nedrow
  • 1,098
  • 1
  • 9
  • 26

1 Answers1

0

It's almost certainly not a bug with AppCode, but without seeing the interface declaration for FooType it's hard to say for sure. It's most likely a misplaced 'nullable' attribute which the compiler is interpreting as a type definition.

William LeGate
  • 540
  • 7
  • 18