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?