Post

Replies

Boosts

Views

Activity

URLSession: The network connection was lost.
I'm seeing behaviour that I'm struggling to work out when making GraphQL related network requests (these are POST requests). I note that QA1941 covers the "lost connection" errors that I see in my responses, but I'd like to understand more, because just retrying the connection without understanding why I need to seems problematic. Here's the (partially redacted) logs I see when the error occurs: quic_conn_keepalive_handler [C69.1.1.1:2] [-0178f8467262b9e978791446c6629ddb66b2efc1] keep-alive timer fired, exceeding 2 outstanding keep-alives nw_read_request_report [C69] Receive failed with error "Operation timed out" nw_read_request_report [C69] Receive failed with error "Operation timed out" nw_read_request_report [C69] Receive failed with error "Operation timed out" nw_read_request_report [C69] Receive failed with error "Operation timed out" nw_read_request_report [C69] Receive failed with error "Operation timed out" 0x16264d818 69 stalled, attempting fallback Task <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11> HTTP load failed, 1822/0 bytes (error code: -1005 [4:-4]) Task <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12> HTTP load failed, 1823/0 bytes (error code: -1005 [4:-4]) nw_endpoint_flow_fillout_data_transfer_snapshot copy_info() returned NULL Task <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x60000139bd50 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x60000a217340 [0x1e006f658]>{length = 16, capacity = 16, bytes = 0x100201bb646394820000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://myserver.com/graphql, NSErrorFailingURLKey=https://myserver.com/graphql, _kCFStreamErrorDomainKey=4} Task <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x60000139afd0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x60000a217340 [0x1e006f658]>{length = 16, capacity = 16, bytes = 0x100201bb646394820000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://myserver.com/graphql, NSErrorFailingURLKey=https://myserver.com/graphql, _kCFStreamErrorDomainKey=4} GraphQL request query failed for query with hash: 6677767707705440859 with error: Networking.NetworkGraphQLService.Error.underlying(Apollo.URLSessionClient.URLSessionClientError.networkError(data: 0 bytes, response: nil, underlying: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x60000139afd0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x60000a217340 [0x1e006f658]>{length = 16, capacity = 16, bytes = 0x100201bb646394820000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <3B0AAA67-3162-4F80-A930-D93F8A7EF1A4>.<12>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://myserver.com/graphql, NSErrorFailingURLKey=https://myserver.com/graphql, _kCFStreamErrorDomainKey=4})) GraphQL request query failed for query with hash: 148576198322832328 with error: Networking.NetworkGraphQLService.Error.underlying(Apollo.URLSessionClient.URLSessionClientError.networkError(data: 0 bytes, response: nil, underlying: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x60000139bd50 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x60000a217340 [0x1e006f658]>{length = 16, capacity = 16, bytes = 0x100201bb646394820000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <A6CC8D4D-83E1-4C61-96C7-BDDF2F04A35F>.<11>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://myserver.com/graphql, NSErrorFailingURLKey=https://myserver.com/graphql, _kCFStreamErrorDomainKey=4})) GraphQL request query starting for query with hash: -5824714640174886330 nw_connection_copy_connected_local_endpoint_block_invoke [C90] Connection has no local endpoint nw_connection_copy_connected_local_endpoint_block_invoke [C90] Connection has no local endpoint GraphQL request query succeeded for query with hash: -5824714640174886330 nw_read_request_report [C43] Receive failed with error "Operation timed out" nw_read_request_report [C43] Receive failed with error "Operation timed out" nw_read_request_report [C43] Receive failed with error "Operation timed out" nw_connection_add_timestamp_locked_on_nw_queue [C43] Hit maximum timestamp count, will start dropping events nw_endpoint_flow_fillout_data_transfer_snapshot copy_info() returned NULL I'd really appreciate any advice or insight that people might have — I can't reproduce this problem consistently, so I want to know more. Thanks!
2
0
121
2d
Do I need to update the certificate of the APNs?
Currently, our provider server uses token-based authentication with APNs. In addition, to establish a connection with APNs, we have installed the "AAACertificateServices 5/12/2020" certificate from the "Sectigo KnowledgeBase website" on the provider server. Question 1 Do I need to update the server certificate of the Apple Push Notification Service at the following URL for the above provider server? URL https://developer.apple.com/jp/news/?id=09za8wzy Question 2 If registration is required, how long will it be valid for? Root certificate https://developer.apple.com/documentation/usernotifications/setting-up-a-remote-notification-server Token-based authentication https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns
0
0
60
1d
SwiftData: Migrate from un-versioned to versioned schema
I've realized that I need to use migration plans, but those required versioned schemas. I think I've updated mine, but I wanted to confirm if this was the proper procedure. To start, none of my models were versioned. I've since wrapped them in a VersionedSchema like this: enum TagV1: VersionedSchema { static var versionIdentifier: Schema.Version = .init(1, 0, 0) static var models: [any PersistentModel.Type] { [Tag.self] } @Model final class Tag { var id = UUID() var name: String = "" // Relationships var transactions: [Transaction]? = nil init(name: String) { self.name = name } } } I also created a type alias to point to this. typealias Tag = TagV1.Tag This is what my container looks like in my app file. var sharedModelContainer: ModelContainer = { let schema = Schema([ Tag.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() The application builds and run successfully. Does this mean that my models are successfully versioned now? I'm trying to avoid an error I came across in earlier testing. That occurred because none of my models were versioned and I tried to setup a migration plan Cannot use staged migration with an unknown coordinator model version.
0
0
74
1d
"purchaseDate" of the Reciepts
I have some questions regarding the specifications of the receipt information that can be obtained from https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info. When a subscription is newly purchased, it is expected that the purchaseDate should reflect the time of purchase and should not be later than this time, such as an hour after the purchase. Is this understanding correct? We observed a phenomenon where, when a user purchased a new subscription between 17:30 and 20:00 JST on November 3, 2024, the purchaseDate in the received receipt was delayed by one hour compared to the actual purchase time. Is this a specification or an issue? When validating the receipt for a newly purchased subscription, if the purchaseDate reflects a time later than when the purchase was made, should I regard the user as having subscription rights at the time of validation?
0
0
78
1d
Sequoia 2 Beta webserver goes off line after 2 hours.
MINI M2 Apache httpd stopped serving with this in log: "bug_type":"312","os_version":"macOS 15.2 (24C5079e)"} {"issueCategory":"hitch","logType":"Tailspin","uploadAttemptCount":0, Sequoia 15.2 Beta Server runs about 2 hours and then need to reboot computer to restart to server remote viewers. Brew Service ReStart and sudo apachectl graceful restart server for localhost but they will not restart server for remote viewers.
0
0
61
1d
Call Blocking and Identification Issue in iOS 18
When Call Blocking and Identification is enabled, information such as Caller Name, number and Call Identification Label is displayed correctly in the incoming call screen. But in Recents screen the call record is not displaying any name or number but instead displays only the Call Identification label that was passed in CXCallDirectoryProvider is displayed. Note: This issue is not observed when the call blocking and identification permission is not granted and the same code is working fine in iOS 17.x
0
0
58
1d
Sync SwiftData via CloudKit on App Start
I have an app that uses SwiftData with CloudKit to synchronize data across a users devices. I'm able to replicate data created on one device on another and when removing data, it is also removed on the other device. So, I know that SwiftData and CloudKit are configured correctly. What I'd like to do though, is to ensure that if a user installs the app on an additional device, that the data is synchronized upon app start. When testing my app on a third device, via TestFlight, there was no data in the app upon launch even though all three devices are using the same Apple account (e.g. Apple ID). What is the best way to achieve this?
4
1
95
3d
Background fetching data not work
Hello, I have a some problem with background fetch. In my app I use background modes for fetch data and display on my home widget iPhone. Its working correct when I built app on my phone from Xcode but when I distribute my app on TestFlight my home widget not updating at all. Help me understand if this issue is only due to TestFlight resources, or should I try releasing the app and hope that it will work in the release version?
1
0
139
2d
Contacts: remove member from group not working on macOS
Hi, In my app, I have an option to remove a contact from a contact group (using the Contacts framework), and it's been working fine till recently users of the macOS version reported that it's not working. I have been using the CNSaveRequest removeMember(contact, from: group) API. The same API works fine on iOS. I'm not sure when it started but it seems to be affecting macOS14.6 as well as 15.1. I was able to reproduce it in a small test project as well, and have the same experience (the API works on iOS but not on macOS), so it definitely seems like a problem with the framework. Can someone confirm this, and/or suggest a workaround? Here's the code I run to test it out ...a simple SwiftUI view that has 4 buttons: Create contact and group Add contact to group Remove contact from group (optional) cleanup by deleting contact and group It's the 3rd step that seems to fail on macOS, but works fine on iOS. Here's the code to test it out: struct ContentView: View { let contactsModel = ContactsStoreModel() var body: some View { VStack (alignment: .center, spacing: 15){ Button ("1. Add Contact And Group") { print("add contact button pressed") contactsModel.addTestContact() if let _ = contactsModel.createdContact { print("created contact success") } } Button ("2. Add Contact To Group") { print("add to group button pressed") contactsModel.addContactToGroup() } Button ("3. Remove Contact From Group") { print("remove from group button pressed") contactsModel.removeContactFromGroup() } Button ("4. Delete Contact and Group") { print("remove from group button pressed") contactsModel.deleteContactAndGroup() } } .padding() } } #Preview { ContentView() } @available(iOS 13.0, *) @objc final class ContactsStoreModel: NSObject, ObservableObject { let contactStore = CNContactStore() var createdContact : CNContact? var createdGroup : CNGroup? public func addTestContact() { let storeContainer = contactStore.defaultContainerIdentifier() let contact = CNMutableContact() contact.givenName = "Testing" contact.familyName = "User" contact.phoneNumbers = [CNLabeledValue(label: "Cell", value: CNPhoneNumber(stringValue: "1234567890"))] let group = CNMutableGroup() group.name = "Testing Group" print("create contact id = \(contact.identifier)") print("create group id = \(group.identifier)") do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.add(contact, toContainerWithIdentifier: storeContainer) saveRequest.add(group, toContainerWithIdentifier: storeContainer) try contactStore.execute(saveRequest) createdContact = contact createdGroup = group } catch { print("error in store execute = \(error)") } } public func addContactToGroup() { if let contact = createdContact, let group = createdGroup { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.addMember(contact, to: group) try contactStore.execute(saveRequest) } catch { print("error in store execute = \(error)") } } } public func removeContactFromGroup() { if let contact = createdContact, let group = createdGroup { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.removeMember(contact, from: group) try contactStore.execute(saveRequest) } catch { print("error in store execute = \(error)") } } } public func addGroupAndContact() { let storeContainer = contactStore.defaultContainerIdentifier() let group = CNMutableGroup() group.name = "Test Group" print("create group id = \(group.identifier)") if let contact = createdContact { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.add(group, toContainerWithIdentifier: storeContainer) saveRequest.addMember(contact, to: group) try contactStore.execute(saveRequest) createdGroup = group } catch { print("error in store execute = \(error)") } } } public func deleteContactAndGroup() { if let contact = createdContact, let group = createdGroup { do { let mutableGroup = group.mutableCopy() as! CNMutableGroup let mutableContact = contact.mutableCopy() as! CNMutableContact let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.delete(mutableContact) saveRequest.delete(mutableGroup) try contactStore.execute(saveRequest) } catch { print("error in deleting store execute = \(error)") } } } }
0
0
59
2d
NWConnection and "Network is Down" error connecting to ip address and port
I have a pretty straightforward code to connect to a given ip address and port using NWConnection. On the first attempt to connect to the Local Network I see the "Local Network Privacy" dialog and sometimes if I press "Don't Allow" on that dialog everything starts to fail. No matter I do I keep receiving the following error: POSIXErrorCode(rawValue: 50): Network is down Obviously going to settings and allowing local network access to the app doesn't fix the issue. Neither deleting the app and installing it again. The only workaround I found is to restart my device which is unacceptable for a user. My code is really simple, I tried a lot of different approaches to connect but neither approach worked. I am on iOS 18. Is it a known bug? could be possible a bug on my code? Any idea would be really appreciated, thanks!
8
2
186
1w
manage sandbox account clear purchase history not working?
I would like to know whether and how people are getting the sandbox account > manage > clear purchase history feature to work. I clear purchase history (either on my device or at app store connect), and I delete my app from my device. I then run my app from Xcode on my device, and it detects at launch the existence of the purchase, and so I cannot test my purchase user interface. Does this thing actually work as advertised?
0
0
57
2d
How to completely reset SwiftData?
Is it possible to reset SwiftData to a state identical to that of a newly installed app? I have experienced some migration issues where, when I add a new model, I need to reinstall the entire application for the ModelContainer creation to work. Deleting all existing models does not seem to make any difference. A potential solution I currently have, which appears to work but feels quite hacky, is as follows: let _ = try! ModelContainer() modelContainer = try! ModelContainer(for: Student.self, ...) This seems to force out this error CoreData: error: Error: Persistent History (66) has to be truncated due to the following entities being removed: (...) which seems to reset SwiftData. Any other suggestions?
2
0
73
2d
Swiftdata + Cloudkit + Mac OS how to configure for existing Swift Data store
Hi, I have a mac os app that I am developing. It is backed by a SwiftData database. I'm trying to set up cloudkit so that the app's data can be shared across the user's devices. However, I'm finding that every tutorial i find online makes it sound super easy, but only discusses it from the perspective of ios. The instructions typically say: Add the iCloud capability. Select CloudKit from its options. Press + to add a new CloudKit container, or select one of your existing ones. Add the Background Modes capability. Check the box "Remote Notifications" checkbox from its options. I'm having issue with the following: I don't see background modes showing up or remote notifications checkbox since i'm making a mac os app. If i do the first 3 steps only, when i launch my app i get an app crash while trying to load the persistent store. Here is the exact error message: Add the iCloud capability. Select CloudKit from its options. Press + to add a new CloudKit container, or select one of your existing ones. Add the Background Modes capability. Check the box "Remote Notifications" checkbox from its options. Any help would be greatly appreciated. var sharedModelContainer: ModelContainer = { let schema = Schema([One.self, Two.self]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() The fatal error in the catch block happens when i run the app.
7
0
440
Oct ’24
continue UserActivity in AppDelegate not working after firing completion(INSendPaymentIntentResponse(code: .failureRequiringAppLaunch, userActivity: userActivity ))
func handle(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) { if let _ = intent.payee, let currencyAmount = intent.currencyAmount { let userActivity = NSUserActivity(activityType: "com.rapipay.nye.test.failure") userActivity.userInfo = ["amount": Int(truncating: currencyAmount.amount!)] completion(INSendPaymentIntentResponse(code: .failureRequiringAppLaunch, userActivity: userActivity )) return } } func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { print("ddddd") return true } this code is perfectly working on simulator and even i fi user userActivity as nil, continue userActivity is called, but on device it is not called Siri is working, asking for name and amount and handler is also called and opens app but does not pass intent or userActivity
7
0
251
Oct ’24
Does iOS Automatically Reconnect to Disconnected BLE Devices, or Is It App-Driven?
Does iOS Automatically Reconnect to Disconnected BLE Devices, or Is It App-Driven? I have a few questions regarding BLE device reconnections in iOS: When a BLE device gets disconnected, does iOS automatically attempt to reconnect to it, or is it the app’s responsibility to handle the reconnection logic? If the app doesn’t initiate a BLE scan, will the OS still attempt to reconnect to previously paired devices, or is manual intervention by the app necessary? What is the recommended approach to re-establish a BLE connection when: The app has been deleted. The BLE device remains connected in the iPhone's Bluetooth settings. The app is reinstalled later. Any insights or best practices would be greatly appreciated!
0
0
36
2d