I’ve seen an strange behavior with te refresh policy.
if you put a print(“hello”) in the timeline function, it will print a bunch of hello per second, and the CPU will be over 50%.
I would expect it to print hello tomorrow, but it’s no happening.
maybe it’s a bug?
Does it happens to you?
Post
Replies
Boosts
Views
Activity
I see the same behavior.
Timeline:
public func timeline(with context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
var entries: [SimpleEntry] = []
let currentDate = Date()
for minuteOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .minute, value: minuteOffset, to: currentDate)!
let entry = SimpleEntry(date: entryDate)
entries.append(entry)
}
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
}
Simple entry func:
struct SimpleEntry: TimelineEntry {
public let date: Date
}
Even for this simple timeline, the CPU of the device goes between 30% to 50% all the time, and that's because, timeline its executing the code inside 17 times per second.
I think it's a bug, or if someone thins otherwise, please share an example.
Thanks in advance,
I'm too struggling to find a way to use correctly network fetching for the widget.
Theres no clear example on Apples Doc, and After implementing the classes and delegates as per Apple's Doc, I receive the same message as you:
connection to background transfer daemon invalidated
It would help a lot if the demo code from apple,
BuildingWidgetsUsingWidgetKitAndSwiftUI Had the networking code.
Do you guys know of an example with the networking code working?
I'm having the same problem.
When I connect the device to Xcode and start debugging it works as it should, the widgets appears on the widget gallery.
I have sent two versión of the app, and both have been rejected because the widgets don't appear on the widget Gallery.
I have deleted the Intent file from the project, and nothing.
As of now, I don't know what to do.
Hi,
I'm having the same issue, test it on Xcode Beta 5.
WidgetKit: closure #1 in WidgetExtensionContext.getDescriptors(completion:) + 208
On Organizer.
The new beta 5 needs to implement in the TimeLineProvider a new method called getSnapshot. Despite being implemented, the same thing happens.
Locally the widget shows in the widget gallery, but when upload to TestFlight, doesn't appear on the gallery.
I'm having the exact same issue.
I have tree building targets:
Main app: iOS 13
TodaysExtension: iOS 13
WidgetKit: iOS 14
I assumed that the Deployment info section was a way to specify in witch iOS versión should the target be available.
Is there a way to exclude completely the target for non iOS 14 versions?
Hi,
Thanks for your response.
I started doing the things you suggested and find some interesting behavior: I created a new project using Xcode Version 11.7 (11E801a) the project consisted of two targets: MainApp and TodaysExtension, both on target 13.0
Then opened the project on Xcode version 12.0 beta 6 (12A8189n), and added the WidgetKit obviously on target 14.0
Then I wan the app on an iPad with iOS versión 13.x.
The worked as it should.
Then I made a copy of my app, opened in Xcode Version 11.7 (11E801a) and deleted the Widget all together, target and code, compile it and there's an error on Xcode
ld: framework not found WidgetKit
cd /Users/jgomez/Documents/Desarrollos/Copia\ de\ airpollution/airpollution
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios13.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk -L/Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Products/Debug-iphoneos -F/Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Products/Debug-iphoneos -filelist /Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Intermediates.noindex/purpleair.build/Debug-iphoneos/purpleair.build/Objects-normal/arm64/purpleair.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Intermediates.noindex/purpleair.build/Debug-iphoneos/purpleair.build/Objects-normal/arm64/purpleair_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Intermediates.noindex/purpleair.build/Debug-iphoneos/purpleair.build/Objects-normal/arm64/purpleair.swiftmodule -framework WidgetKit -Xlinker -dependency_info -Xlinker /Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Intermediates.noindex/purpleair.build/Debug-iphoneos/purpleair.build/Objects-normal/arm64/purpleair_dependency_info.dat -o /Users/jgomez/Library/Developer/Xcode/DerivedData/purpleair-bnshrgiqtoqpatelpqxnpswvzjhq/Build/Products/Debug-iphoneos/purpleair.app/purpleair
framework WidgetKit -Xlinker Despite not having a WidgetKit anymore there's a mention to the library somewhere.
Any ideas on this?
Thanks in advance,