Post

Replies

Boosts

Views

Activity

iOS 16 set and get cookie failure in WKHTTPCookieStore
Hi, I am not able to set and retrieve cookies from WKWebsiteDataStore when running the following test. The getCookies in the below code always comes empty. I dont understand its failing because it is unable to set the cookie or the get is failing to retrieve cookies. Here is the code: let cookieStorage = WKWebsiteDataStore.nonPersistent().httpCookieStore let properties: [HTTPCookiePropertyKey: Any] = [       .domain: "abc.com",       .path: "/",       .name: "name",       .value: "value",       .secure: "TRUE"     ] let cookie = HTTPCookie(properties: properties)! let cookies = [cookie] let cookieExpectation = self.expectation(description: "cookieExpectation")       cookieStorage.setCookie(cookies[0]) {     cookieStorage.getAllCookies { getCookies in      let mappedCookies = Dictionary(uniqueKeysWithValues: cookies.map { ($0.name, $0.value ) })      let mappedGetCookies = Dictionary(uniqueKeysWithValues: getCookies.map { ($0.name, $0.value ) })      XCTAssertEqual(mappedCookies, mappedGetCookies) cookieExpectation.fulfill()   } } This is failing on iOS 16 simulator. For iOS 15 simulator and mac Catalyst the test case succeeds without any problem. Checked this on xcode 14 release and xcode 14.1 Beta 2
0
1
1.1k
Sep ’22
Access values from umbrella header in a swift package
I am trying to migrate a framework (MyFmwk) project to a swift package. My framework project has a MyFmwk.h umbrella header which was generated by Xcode when I initially created my framework. How can I access swift FOUNDATION_EXPORT double MyFmwkVersionNumber; present in the umbrella header in one of my swift target in the swift package? Also how can I make my umbrellaheader (MyFmwk.h) visible to my swift target. Thanks
0
0
625
Apr ’21
Dynamic WidgetConfiguration
Hi, Is there a way I can pass StaticConfiguration or IntentConfiguration depending upon some conditions? right now it gives build error: Function declares an opaque return type, but the return statements in its body do not have matching underlying types var body: some WidgetConfiguration {     if condition {       return IntentConfiguration(kind: kind, intent: MyIntent.self, provider: Provider()) { entry in         MyWidgetEntryView(entry: entry)       }       .configurationDisplayName("")       .description("")       .supportedFamilies([.systemLarge])     } else {       return StaticConfiguration(kind: kind, provider: MyProvider()) { entry in         MyWidgetEntryView(entry: entry)       }.configurationDisplayName("")       .description("")       .supportedFamilies([.systemLarge])     }   } I know this has to do with opaque return type, but is there a way to achieve this?
1
0
661
Sep ’20
Customising edit widget UI
How to get the UI which appears when you try editing clock widget (City) in iOS 14 beta 7? Here it tells it all depends upon the intent definition file https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget so how to configure the intent definition file? what kind of params should it have and relationships between params if any
0
0
609
Sep ’20
Timelineentries rendered too soon
As per the doc for TimelineEntry /// The date for WidgetKit to render a widget. var date: Date { get } If my understanding is correct, this would mean if i have to make an entry appear on the widget on D1, then i should set the date for the entry to be D1 but what i have seen is the entry appears earlier than this date D1, ie at a date earlier than D1 What is going wrong here? why does the system doesn't respect the set date? This was tested a on device running iOS 14 beta 5, built with Xcode 12 beta 5.
0
0
358
Aug ’20
onDisappear not getting called for widget
Below is the body of my main entry view for a widget. onAppear seems to be working fine, but onDisappear is never getting called. How can I know that widget is offscreen and not visible to the user? Are there any other events similar to view controller lifecycle for a swiftui view? var body: some View {     Text("Hello world")       .onAppear{         print("onAppear called")       }       .onDisappear {         print("onDisappear called")       }   } Console output onAppear called
2
0
1.7k
Jul ’20
Crash on using List in iOS 14 Widget
Xcode 12 crashes on using List in an iOS 14 widget. Fatal error: PlatformViewRepresentableAdaptor&lt;ListRepresentable<SystemListDataSource<Never&gt;, SelectionManagerBox&lt;Never&gt;>>: file /Library/Caches/com.apple.xbs/Sources/Chrono/Chrono-70.4/WidgetKit/SPI/WidgetViewArchive.swift, line 254 2020-07-13 15:34:55.965035+0530 ListWidgetExtension[866:188282] Fatal error: PlatformViewRepresentableAdaptor&lt;ListRepresentable<SystemListDataSource<Never&gt;, SelectionManagerBox&lt;Never&gt;>>: file /Library/Caches/com.apple.xbs/Sources/Chrono/Chrono-70.4/WidgetKit/SPI/WidgetViewArchive.swift, line 254 Will this be fixed in the next betas? or are lists not allowed to be used in a widget? If lists are not allowed then how can I show multiple columns of data?
3
0
902
Jul ’20