Widgets not working with TestFlight since Xcode 12 beta 3

I have noticed a strange problem today. I have uploaded a build of my app to TestFlight for internal testing using Xcode 12 beta 3. The app has widgets and if I run the app locally from Xcode widgets are working on device.

However, when I install a beta from TestFlight the widgets are not suggested by iOS and I can see in the logs that the widgets are actually crashing (something is going on with WidgetKit in the crash logs).

This has started only with beta 3, I have previously used TestFlight with widgets in beta 1 and beta 2.

Does anyone else have this problem? My feedback number is FB8122742.
Answered by Mr. Brightside in 625976022
Ok, here is the solution to this problem.
  1. Make sure that you use Xcode 12 beta 4 and iOS 14 beta 4 on your devices.

  2. Make sure that you have placeholder(in:) implemented. Make sure that you don't have placeholder(with:) because that's what the previous beta of Xcode was suggesting with autocompletion and without that you won't get your placeholder working. I think this whole problem is caused by the WidgetKit methods getting renamed but that's another story.

  3. As per the release notes, you need to set "Dead Code Stripping" to NO in your extension target's build settings. This is only necessary for the extension's target. When uploading your archive to the App Store Connect, uncheck "Include bitcode for iOS content".

  4. Delete your old build from a device when installing a new beta.

That should do the trick.

Accepted Answer
Ok, here is the solution to this problem.
  1. Make sure that you use Xcode 12 beta 4 and iOS 14 beta 4 on your devices.

  2. Make sure that you have placeholder(in:) implemented. Make sure that you don't have placeholder(with:) because that's what the previous beta of Xcode was suggesting with autocompletion and without that you won't get your placeholder working. I think this whole problem is caused by the WidgetKit methods getting renamed but that's another story.

  3. As per the release notes, you need to set "Dead Code Stripping" to NO in your extension target's build settings. This is only necessary for the extension's target. When uploading your archive to the App Store Connect, uncheck "Include bitcode for iOS content".

  4. Delete your old build from a device when installing a new beta.

That should do the trick.

I only see the answer after post this comment, so forget about this.



Using Xcode 12 beta 5, still having this issue: Widget works locally on a device from Xcode but not after I distribute it through TestFlight, it just disappeared. Any ideas?

Below is my codes:
Code Block swift
struct Provider: IntentTimelineProvider {
  typealias Entry = ScreenTimeEntry
  typealias Intent = ConfigurationIntent
  func placeholder(with: Context) -> ScreenTimeEntry {
    let entry = ScreenTimeEntry.sample
    return entry
  }
  public func snapshot(for configuration: ConfigurationIntent, with context: Context, completion: @escaping (ScreenTimeEntry) -> ()) {
    let entry = ScreenTimeEntry(date: Date(), configuration: configuration)
    completion(entry)
  }
  public func timeline(for configuration: ConfigurationIntent, with context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
    let currentDate = Date()
    let entries: [ScreenTimeEntry] = [
      ScreenTimeEntry(date: currentDate, configuration: configuration)
    ]
    let timeline = Timeline(entries: entries, policy: .atEnd)
    completion(timeline)
  }
}


Restart the device and you will see widget again. Just restart it and we don't need to do anything.
I'm having this issue with Xcode 12.2 again.
Widget in Testflight build can not work for some devices (14.2.x).

The two issues "Dead Code Stripping", and disable "Bitcode" were solved by Apple and mentioned in Xcode 12 release note.
But I'm not sure if Xcode 12.x has the issue again, or just an iOS version bug?

(Reboot the phone make Widget works again, but got down after awhile again)
Found this thread after having issues with my widgets in TestFlight as well. Is the solution in this thread also required for publishing to the App Store? Our only for test flight?
Hi, I just published my app to TestFlight and facing the same problem. Can find widgets in widgets list, but there are empty...
I tried all I found here, but nothing works for me.
Appreciate any help...
Facing the same problem. It seems to be Apple gift to waste our time...
We are recently facing this issue. The widget works great in the simulator and debug mode but then doesn’t show in release builds or on TestFlight. I have tried all the above recommendations including the no bitcode, and turning off dead code stripping(throughout the project). Any new solutions out there?
Same issue, followed all the advice here, still the widget is not showing up when installing the app via TestFlight.
Any solutions?

Same issue with XCode(Version 12.5.1 (12E507)) and iPhone(14.6)

Same issue with XCode v14.1 and iPhone(16.0)

Widgets not working with TestFlight since Xcode 12 beta 3
 
 
Q