Semantic issue after installing Xcode utilities

Hello,


I'm maintaining a legacy application in Objective-C which used to compile finely. Last week Xcode aked for installing some utilities and the only option where allowing it (the other was quitting). After doing it semating issues appeared on this file.


//
//  FLLWebViewController.m
//
//
//  Created by Dario Trisciuoglio on 06/05/13.
//  Copyright (c) 2013. All rights reserved.
//

#import "FLLWebViewController.h"
#import "FLLWebView.h"
#import "NSTimer+FLLInterface.h"

@interface FLLWebViewController ()
{
    __weak NSTimer* _timer;
    NSURL* _url;
}


@end

@implementation FLLWebViewController

#pragma mark -

-(NSURL *)URL
{
    if(!_url)
    {
        if(self.viewModelData[@"url"])
            _url = [NSURL URLWithString:self.viewModelData[@"url"]];
        else
            _url = self.viewModelData[@"URL"];
    }
    return _url;
}

#pragma mark - UIViewController CycleLife

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationItem.title = self.viewModelData[@"title"];
}

-(void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    if (_timer)
    {
        [_timer invalidate];
        _timer = nil;
    }
}

#pragma mark - Dealloc

-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [self performDealloc];
}

#pragma mark - FLLViewDelegate

-(void)refreshControl:(UIRefreshControl *)refreshControl force:(BOOL)force
{
    [super refreshControl:refreshControl force:force];
    if(self.URL)
    {
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:self.URL];
        request.timeoutInterval = 30;
        request.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
        [self.webView loadRequest:request];
        [[FLLActivityIndicatorController activityIndicatorController] show];
    }
}

#pragma mark - UIWebViewDelegate

-(void)webViewDidStartLoad:(UIWebView *)webView
{
    if(_timer == nil)
        _timer = [NSTimer scheduledTimerWithTimeInterval:30 weakTarget:self selector:@selector(removeActivityIndicator) userInfo:nil repeats:NO];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [[FLLActivityIndicatorController activityIndicatorController] hide];
    [_timer invalidate];
    _timer = nil;
    self.backBtn.enabled = [webView canGoBack];
    self.forwardBtn.enabled = [webView canGoForward];
    self.backBtn.enabled = [webView canGoBack];
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [[FLLActivityIndicatorController activityIndicatorController] hide];
}

-(void)removeActivityIndicator
{
    [_timer invalidate];
    _timer = nil;
    [[FLLActivityIndicatorController activityIndicatorController] hide];
}

#pragma mark - IBAction

-(IBAction)goWebViewBack:(id)sender
{
    [self.webView goBack];
}

-(IBAction)goWebViewForward:(id)sender
{
    [self.webView goForward];
}

-(IBAction)goWebViewRefresh:(id)sender
{
    [self.webView reload];
}

-(IBAction)goWebViewStopRefresh:(id)sender
{
    [self.webView stopLoading];
}

@end


The error is the same on line 30, 31, 33 and 43: Expected method to read dictionary element not found on object of type 'id<FLLWebViewModelData>'


This is the header file:


//
//  FLLWebViewController.h
// 
//
//  Created by Dario Trisciuoglio on 06/05/13.
//  Copyright (c) 2013. All rights reserved.
//

#import "FLLViewController.h"
#import "FLLWebView.h"

@protocol FLLWebViewModelData 

@property (nonatomic, readonly) NSString* title;
@property (nonatomic, readonly) NSURL* URL;

@optional
@property (nonatomic, readonly) NSString* url;

@end

@interface FLLWebViewController : FLLViewController 

@property (nonatomic, readonly) NSURL* URL;

@property (nonatomic, strong) id viewModelData;

@property (nonatomic, weak) IBOutlet FLLWebView* webView;
@property (nonatomic, weak) IBOutlet UIBarButtonItem* backBtn;
@property (nonatomic, weak) IBOutlet UIBarButtonItem* forwardBtn;
@property (nonatomic, weak) IBOutlet UIBarButtonItem* refreshBtn;
@property (nonatomic, weak) IBOutlet UIBarButtonItem* stopRefreshBtn;

-(IBAction)goWebViewBack:(id)sender;
-(IBAction)goWebViewForward:(id)sender;
-(IBAction)goWebViewRefresh:(id)sender;
-(IBAction)goWebViewStopRefresh:(id)sender;

@end


Does anyone know why it suddenly broke and how could I fix it?

>maintaining a legacy application


What versions Xcode did you migrate from and to?


Did you perform a clean build folder after moving to a newer Xcode?


Using any 3rd party frameworks/libs/tools? PMK?

It looks like there is a declaration of the viewModelData property somewhere else, where the type is specified as id<FLLWebViewModelData> rather than just id. In that case, the error message is correct. (The subscript expression implies a message-send to the object, but the object must be known to implement the subscript method, OR the object reference must be a variable of type id. Type id<FLLWebViewModelData> does not count as plain id for this special message-send behavior.)


My guess is that you have some other declaration that says the type is id<FLLWebViewModelData> and the behavior might be different because the compilation order changed due to some change in the latest clang compiler.


It's also possible that it was just a bug that it ever worked, and the bug is fixed now.

How can I access that url property then? With this.viewModelData it compiles but it's probably referencing another attribute rather than the one in the dictionary, right?

Semantic issue after installing Xcode utilities
 
 
Q