Hi all,
I am having trouble deciphering a "passing argument ... from distinct Objective-C type warning".
I have a constant string declared as:
extern NSString * const URL_1;
and defined as:
NSString * const URL_1 = @"http://someurl";
If I, say, assign that constant to an NSString as follows:
NSString *URL = nil;
...
URL = [[NSString alloc] initWithString:URL_1];
And pass this NSString as an argument to a function expecting an NSString:
ViewController *viewController = [[ViewController alloc] initWithURL:URL];
Function signature:
- (id)initWithURL:(NSString *)URL
I receive a warning that I am "passing argument 1 of 'initWithURL': from distinct Objective-C type"
As I understand it NSString objects are immutable once created, and I am assigning the value to the string once upon creation, so I don't understand why the constant nature of URL_1 should cause a problem.
I am sure I am being a donut here and have overlooked something simple! Please could someone help me resolve this warning? Many thanks in advance!