SolvedAFNetworking Apple Review

After uploading the App to appstoreconnect,we receive this message:

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.

I am integrating AFNetworking by CocoaPods,I wonder how can i delete the files that using UIWebView related API.

45 Answers

✔️Accepted Answer

Same problem. It would be better if we could just update the Pod rather than manually add to .the project.

Add this code in you Podfile, for just remove the files releated UIWebView automatic.

pre_install do |installer|
    puts 'pre_install begin....'
    dir_af = File.join(installer.sandbox.pod_dir('AFNetworking'), 'UIKit+AFNetworking')
    Dir.foreach(dir_af) {|x|
      real_path = File.join(dir_af, x)
      if (!File.directory?(real_path) && File.exists?(real_path))
        if((x.start_with?('UIWebView') || x == 'UIKit+AFNetworking.h'))
          File.delete(real_path)
          puts 'delete:'+ x
        end
      end
    }
    puts 'end pre_install.'
    end
end

Other Answers:

@seanLee If you integrate AFNetworking with Cocoapods and you don't need AFNetworking/UIKit subspec, you could define your podfile like this:
pod 'AFNetworking', '~> 2.0', :subspecs => ['Reachability', 'Serialization', 'Security', 'NSURLSession', 'NSURLConnection']
Define your version number properly and depends on your dependences you could remove NSURLConnection.

@leviduan The answer was given by Kirian above. Change your Podfile to
pod 'AFNetworking', '~> 3.0', :subspecs => ['Reachability', 'Serialization', 'Security', 'NSURLSession']

You may like to try my fork: https://github.com/ElfSundae/AFNetworking

  • The latest commit on the master branch
  • Removed UIWebView related code
  • Fixed API availability warnings for NSURLSessionTaskMetrics #4516

You can compare changes here.

Installation:

  • CocoaPods

    pod 'AFNetworking', '~> 3.0', :source => 'https://github.com/ElfSundae/CocoaPods-Specs.git'
  • Carthage

    github "ElfSundae/AFNetworking" ~> 3.0
    

@coskungun just upgrade the library to version 4
pod 'AFNetworking', '~> 4.0'