title: Detect iOS version in xcode - Unexpected '@' in program
body: <p>I have inherited some code in xcode (below) and am getting an <code>'Unexpected '@' in program'</code> error reported.</p>
  
  <p>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</p>
  
  <p>From researching, I have determined that the issue is with this part of the code:</p>
  
  <pre><code> if (@available(iOS 9.0, *)) {
  </code></pre>
  
  <p>Which I need to change to</p>
  
  <pre><code>if #available(iOS 9.0, *) {
  </code></pre>
  
  <p>But if I do that, I then get the following error</p>
  
  <pre><code>Expected '(' after 'if'
  </code></pre>
  
  <p>The original piece of code is    </p>
  
  <pre><code>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
      }
  }
  </code></pre>
  
  <p>And this is what I have tried to change it to</p>
  
  <pre><code>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
      }
  }
  </code></pre>
  
  <p>Any help would be appreciated, thank you.</p>