<unknown>:0: warning: imported declaration 'UITableViewDiffableDataSourceCellProvider' could not be mapped to 'UITableViewDiffableDataSourceReference.CellProvider'

In Xcode 11, Xcode shows some warnings of my project, how can I solve these warnings?

The warnings shows like this:

<unknown>:0: warning: imported declaration 'UITableViewDiffableDataSourceCellProvider' could not be mapped to 'UITableViewDiffableDataSourceReference.CellProvider'

<unknown>:0: warning: imported declaration 'UICollectionViewDiffableDataSourceCellProvider' could not be mapped to 'UICollectionViewDiffableDataSourceReference.CellProvider'

Replies

+1, seeing the same warning here

Something to do with custom table view cells?

+1

The same in my project:

<unknown>:0: error: imported declaration 'UITableViewDiffableDataSourceCellProvider' could not be mapped to 'UITableViewDiffableDataSourceReference.CellProvider'
<unknown>:0: error: imported declaration 'UICollectionViewDiffableDataSourceCellProvider' could not be mapped to 'UICollectionViewDiffableDataSourceReference.CellProvider'

Same issue here. It compiles fine to Simulator but not to device.

Try cleaning your build folder and rebuilding.

The weird workaround that is working for me is to compile the project selecting an older simulator (in my case 10.3.1) first. When build succeeds you can select and launch the app on any iOS 13 simulator.

Interestingly, on iPadOS 13 beta 1 my UITableViewCell subclass is now rendering images at their x3 size instead of resizing to the height of the cell. Working around it at the moment by setting the view and text frames explicitly in layoutSubviews().

[and before I get the "are you calling super" reply ... yes I was/am 😉 ]


Still seeing the warning as described above in the log, as far as I can see, code that has always worked previously is now generating this warning. Maybe just one of the initial bugs in iOS 13?

A complete clean build never works for me.

What work for me is an incremental build without cleaning, always work.

Trying looking in XCode, Preferences, Locations Tab, and seeing if the command line tools point to the XCode 11 tools.

Fixed all warnings, thanks!

In my case, they are 2 ways to get rid of this warning:

  1. set the simulator to iPhone Xs before building your app, this is just a workaround.
  2. If your code imports UIKit by "import" in Swift or by "#import " in OC, and indeed the UITableViewDiffableDataSourceCellProvider and other 2 modules are not deployed by your code, then try to replace "#import " with "@import UIKit;" in OC, while "@import UIKit" in swift. Because "@import" allows you only imports modules which are really used by your implementation.

Thank you for posting about UITableViewDiffableDataSourceCellProvider and @import, that saved me a lot of time.

: - )

I managed to create a similar issue for myself by opening the same project from two different versions of Xcode (10, and beta). Cleaning the build and zapping the derived folders cleared the issue for me.

I'm seeing this when building from the command line both on my own machine and on CircleCI. Because I'm seeing it when building from terminal and CI (but not when building directly inside of Xcode), I'm not able to use the workarounds that others have suggested about swapping simulators, and I'm always doing a clean build already.


This is preventing us from being able to build on CI when treating warnings as errors. We have 29 files that report the failure, but I have yet to be able to find anything that resolves it for us.

@sampsonlor, you mentioned trying `@import UIKit` in Swift. Unless I'm just overlooking something, @import isn't valid in swift, is it? Was there a different syntax you meant to mention there?

Well, @import works for both Swift and OC, please pay attention to the ";" after if ignored.