When you request an http address in IOS9, an error is returned. AVAudioPlayer: Why is the code correct but cannot be played? ios9.avaudioplayer
In the new version of Xcode7.1, errors are always reported during HTTP requests. As long as there are http requests, errors are reported. In iOS9, Apple changed the original http protocol to the https protocol, use TLS1.2 SSL to encrypt request data
There are probably two kinds of errors reported.
First: App Transport Security has blocked a cleartext HTTP (http: //) resource load since it is insecure. Temporary exceptions can be configured via your app's Info. plist file.
Second:NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL,-9807)
The solution to these two errors is as follows:Add the following to info. plist:NSAppTransportSecurity. Its type is dictionary. Then, click + to display two options. ThenNSAllowsArbitraryLoadsSelect YES;
Generally, the network of the http request can appear at this time. If the simulator encounters the second situation, it adds s to the http request or removes s (generally, as long as it is the original URL)
//__________________________________________________________________________________________
Once again, I am working on a background player.AVAudioPlayerI checked my code several times and there was no problem, but there was no sound running in the background. In this case, it may be thatSetThe AVAudioPlayer object is set to a global object (probably because if I set it to a local variable, the compiler may retain this object after compiling the code, it takes some time to play a music. You can reation the object before the dealloc program stops running.
)