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.

This is likely due to the changes in the TimelineProvider APIs that happened in Beta 3. Have a look at this post and update to the latest APIs. https://developer.apple.com/forums/thread/655182?answerId=623062022#623062022
I am seeing the same problem that Mr. Brightside reports. I did adopt the TimelineProvider changes noted in the other thread. I filed FB8135225 with a sample project and sysdiagnose.
If I did not adopt the new TimelineProvider changes, I would not be able to run the app locally on a device from Xcode.

I did adopt the changes, the issue is related to TestFlight.
I adopted the new TimeLineProvider and it works locally but not after I distribute it through TestFlight. It's just broken now. Here is my code: https://developer.apple.com/forums/thread/655182?answerId=623190022#623190022
I have checked the logs when installing the app from Xcode and when installing it from TestFlight.

The difference is that WidgetKit is not able to get a timeline from a widget when the app is installed from TestFlight. That is the reason why the widget is not available for selection.

My best guess is that there is something wrong with signing on TestFlight server.

From TestFlight:
default 11:12:14.851813+1000 chronod [com.mr-brightside.myParcel.ParcelWidget:ParcelWidget:medium:-7973698613864559631@321.0/148.0/20.2] reload: begin
default 11:12:14.856270+1000 chronod [myParcel.ParcelWidget-B81718B65DEC] Session operation: getTimeline request.
default 11:12:14.928178+1000 chronod [myParcel.ParcelWidget-B81718B65DEC] Session operation: getTimeline error result: <private>
error 11:12:14.928569+1000 chronod [com.mr-brightside.myParcel.ParcelWidget:ParcelWidget] reload: failed with error Couldn’t communicate with a helper application.)

From Xcode:
default 11:19:45.639908+1000 chronod [com.mr-brightside.myParcel.ParcelWidget:ParcelWidget:medium:-7973698613864559631@321.0/148.0/20.2] reload: begin
default 11:19:45.802217+1000 chronod [myParcel.ParcelWidget-A713984DD536] Session operation: getTimeline request.
default 11:19:45.939728+1000 chronod [myParcel.ParcelWidget-A713984DD536] Session operation: getTimeline result.
default 11:19:46.129838+1000 chronod [com.mr-brightside.myParcel.ParcelWidget:ParcelWidget] reload: succeeded with 1 entries
default 11:19:46.131989+1000 chronod Task [84] [com.mr-brightside.myParcel.ParcelWidget:ParcelWidget:medium:-7973698613864559631@321.0/148.0/20.2] Completed

Full logs are available in FB8122742
I even set the policy to .never and the problem persists. Interestingly everything worked with TestFlight before Apple announced that now TestFlight supports HomeWidgets.

Code Block        
let timeline = Timeline(entries: [entry], policy: .never)
        completion(timeline)


I am having the same issue. @MeanRaw, were you able to fix it?
@kushsolitary no it continues to be broken. Widget works perfectly locally, but not when it is distributed using TestFlight. It worked before the announcement from Apple that TestFlight now supports HomeWidgets.
I'm beginning to think that the reason widgets don't show up with TestFlight distribution may not be a bug in TestFlight but a bug in Xcode beta 3. Has anyone tried to submit with Xcode beta 2?
Seeing this as well. I have it working with the updated APIs that dropped placeholder. It works locally but not via TestFlight. The build gets to TestFlight without errors though
When I tried submitting with Beta 2 I got an ITMS error saying I'm uploading from an incompatible version of Xcode. When I updated to Beta 3, the error went away, but now I'm running into these issues.
Same here. Is there any developer that has widgets working in beta 3 via Testflight?
I'm having the same issue on Xcode 12, beta 3. The widgets in my project don't load when installed via Testflight, I cannot even add widgets.

This also happens to me when using Ad Hoc distribution, so it's probably not an issue with TestFlight but a distribution issue.
This is a bug in beta 3, a workaround at this time is to disable "Dead Code Stripping" in Build Settings for the widget target.
With "Dead Code Stripping", you'll also have to disable "Bitcode" when submitting the archive through Xcode other it will undo the changes in the build. The widgets should appear in TF builds after these 2 steps.
I tried removing Dead Code Stripping but I'm still not able to access my widgets after installing through TestFlight with Beta 3. They work fine when running from Xcode.
Has anyone tried Xcode beta 4 yet to see if it fixes the problem? The release code does not say anything about this problem. I'm downloading now.
Here in the release notes for beta 4 the issue is referenced...but I've tried these work around and they did not work via TestFlight.

https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes/?id=swift


Swift
Known Issues
Widgets may crash when built for release. (65862827) Workaround: Set DEADCODESTRIPPING to NO in the extension target’s build settings. When you upload the application to App Store Connect, also unset “Include bitcode for iOS content” in the App Store Connect distribution options.






I just tried Xcode beta 4 and the issue is NOT resolved.
Right Xcode beta 4 still has the problem.

I discovered that to reproduce the problem you don't even need to submit through TestFlight. Just building in Xcode as release (vs debug) causes widgets to disappear.

I have also tried the "dead-code stripping" settings in "build settings" for the target and changing that does not fix the problem either. Given that HomeWidgets is an important feature of iOS 14, it's strange that Apple has not tested this once and even stranger that after filing bug reports against beta 3, they still have not fixed the problem in beta 4.
Yeah it's pretty annoying. I'm trying to get a new build of my app up on TestFlight but I'm currently stuck.
Has anyone been able to successfully to get a working widget through TestFlight when uploading with xcode beta 3 or 4?

I've tried Apple's suggested workaround by changing dead-code settings and unsetting “Include bitcode for iOS content” in the App Store Connect distribution options with no luck.
After updating to iOS Beta 4, it seems the widgets are now appearing again (at least with the build I have with dead-code stripping and unchecking including the iOS Bitcode)
@khuffie do you mean the HomeWidget appears when you distribute through TestFlight? Multiple people have reported that they don’t (including myself). Widgets don’t even appear when you create a release build.
@RawMean I can confirm that with Xcode 12, beta 4, the following worked for me:
  • Set DEAD_CODE_STRIPPING to NO

  • Disabled bitcode when uploading to AppStore Connect

  • Installed on iPhone 11 running Public Beta 3 (via TestFlight)

Widgets appeared and looked appropriate in the widget picker interface, but appeared black when installing to home screen. Restarting the device resolved the issue, and the widgets now work.


Widgets not working with TestFlight since Xcode 12 beta 3
 
 
Q