lufinkey/react-native-spotify

UIWebView is deprecated

psoren opened this issue ยท 10 comments

Hi there,

I am using react native 0.60 and I am developing for iOS. I recently submitted my app to the app store, and I received an email from Apple containing the following:

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.

In the link above, Apple suggests using the WKWebView API instead of the UIWebView API. I also viewed the source code for this package, and found the following line in the ios/RNSpotifyWebViewController.m file:

_webView = [[UIWebView alloc] init];

I am not sure of the usage of the WKWebView API, but I do not think that this change would be too difficult.

I'll try to make this change when I have a chance

This is fixed in 1.2.10

Hey @lufinkey, I've been dealing with UIWebview problems in an app I'm working on since Apple does not let apps with UIWebView to be uploaded anymore.

After I removed rn-spotify-sdk from the project, Apple accepted the build, so seems like we still cannot use this package. I'm using version 1.2.13 of this library.

Maybe calls to UIWebView in rn-spotify-sdk/ios/external/SpotifySDK/Demo Projects/Simple Track Playback/Simple Track Playback/WebViewController.m are the problem?

or maybe this line in RNSpotifyAuthController?
#pragma mark - UIWebViewDelegate

Also I don't know if issues can be reopened here; I can create a new one if you want.

Ohh, if you're compiling code from the demo project, you probably shouldn't be doing that. No code from the SDK's demo project should be in your project.

@lufinkey I'm facing the same issue of UIWebView is deprecated, too. Seems there's still has an issue inside your package.

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).

Apple says that every time I submit my app to the store. I found the reason is the Spotify SDK we're using right now in your package contains this deprecated UIWebView.

Let's see how I found it. I'm sure I don't use any UIWebView API, so I type the command below in the root of my project.

grep -r UIWebViewDelegate node_modules/*

And the result shows:

Binary file node_modules/rn-spotify-sdk/ios/external/SpotifySDK/SpotifyAuthentication.framework/SpotifyAuthentication matches

(the file is this one: https://github.com/lufinkey/spotify-ios-streaming-sdk/blob/36b4837a7c144f5768f9cd393ab96fc0636ada23/SpotifyAuthentication.framework/SpotifyAuthentication)

we can achieve the app in this situation to verify if there have parts using deprecated UIWebView, which means finding the dependency on the achieved app files.

// today = (e.g. 2020-05-11)
cd  ~/Library/Developer/Xcode/Archives/${today} 

// e.g. MyApp 2020-5-11, 9.23 PM.xcarchive
cd "${appName} ${today}.xcarchive"

// search dependency
grep -r UIWebView ./*

After those commands, the result shows:

./BCSymbolMaps/9A644DF5-8D3F-31E5-967B-42EA38E95AEF.bcsymbolmap:l_OBJC_PROTOCOL_$_UIWebViewDelegate
./BCSymbolMaps/9A644DF5-8D3F-31E5-967B-42EA38E95AEF.bcsymbolmap:l_OBJC_LABEL_PROTOCOL_$_UIWebViewDelegate
./BCSymbolMaps/31174FD0-92F5-3821-BDF8-5F8B2AEB714A.bcsymbolmap:l_OBJC_PROTOCOL_$_UIWebViewDelegate
./BCSymbolMaps/31174FD0-92F5-3821-BDF8-5F8B2AEB714A.bcsymbolmap:l_OBJC_LABEL_PROTOCOL_$_UIWebViewDelegate

Which means there is something still using the deprecated UIWebView, it also meets the result when we grep UIWebViewDelegate in node_modules.

so, @lufinkey I wonder if there's possible that you can update the Spotify SDK to a relatively new version? I know that the version currently using is deprecated and can't be found in Github, but your package means to import to us --- we have a project depends on your great work. besides that, if the SDK doesn't be updated, it may affect all apps that used your package to deploy to the AppStore.

After trying all sorts of things, I've managed to pass ITMS-90809: Deprecated API Usage

What I did:

  1. yarn upgrade --latest
  2. Deleted /ios/external/SpotifyAuthentication.framework
  3. Removed all references to SpotifyAuthentication (in xcode, global search for SpotifyAuthentication)

Just got an approved TestFlight app.
Spotify.logout(): Works!
Spotify.login(): Works!
Spotify.playURI(...): Works!

@lufinkey Is SpotifyAuthentication not needed in the external folder?? ๐Ÿค”

Oh, and by the way: Thanks for providing this package ๐Ÿ‘ :)