I have inherited some code in xcode (below) and am getting an 'Unexpected '@' in program'
error reported.
I have been able to figure out that this is likely to be due to the fact that the original code was written in xcode >9.0 while my version (due to hardware limitations) is xcode 8.2.1
From researching, I have determined that the issue is with this part of the code:
if (@available(iOS 9.0, *)) {
Which I need to change to
if #available(iOS 9.0, *) {
But if I do that, I then get the following error
Expected '(' after 'if'
The original piece of code is
if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) {
if (@available(iOS 9.0, *)) {
[self.uploadProgress setResumingHandler:^{
__typeof__(weakTask) strongTask = weakTask;
[strongTask resume];
}];
} else {
// Fallback on earlier versions
}
}
And this is what I have tried to change it to
if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) {
if #available(iOS 9.0, *) {
[self.uploadProgress setResumingHandler:^{
__typeof__(weakTask) strongTask = weakTask;
[strongTask resume];
}];
} else {
// Fallback on earlier versions
}
}
Any help would be appreciated, thank you.