# The operation couldn’t be completed. (OSStatus error -9847.)

**URL:** <https://community.apollographql.com/t/the-operation-couldn-t-be-completed-osstatus-error-9847/7224>\
**Category:** Client SDKs\
**Tags:** mobile, ios\
**Created:** [February 19, 2024, 6:30am UTC](https://community.apollographql.com/t/the-operation-couldn-t-be-completed-osstatus-error-9847/7224 "2024-02-19T06:30:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pritish\_Sawant](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/pritish_sawant/32/4336_2.png) [@Pritish\_Sawant](https://community.apollographql.com/u/Pritish_Sawant)\
**Post date:** [February 19, 2024, 6:30am UTC](https://community.apollographql.com/t/the-operation-couldn-t-be-completed-osstatus-error-9847/7224/1 "2024-02-19T06:30:38Z")

</div>

I am trying to use `GraphQL Subscription` on iOS simulator and I get error saying `The operation couldn’t be completed. (OSStatus error -9847.)`

I am using `Apollo iOS 1.9.0`

Is this a simulator issue? I don’t have a real device to test on

Here is my code

```auto
import Apollo
import Foundation
import ApolloWebSocket

class Network {
  static let shared = Network()

    
    private(set) lazy var apollo: ApolloClient = {
        let client = URLSessionClient()
        let cache = InMemoryNormalizedCache()
        let store = ApolloStore(cache: cache)
        
        let url = URL(string: "http://localhost:4000/graphql")!
        let transport = RequestChainNetworkTransport(interceptorProvider: DefaultInterceptorProvider(client: client, shouldInvalidateClientOnDeinit: true, store: store), endpointURL: url)

```

my ViewController is as follows

```auto
import UIKit
import Apollo
import MyUserAPI

class ViewController: UIViewController {
    
    var activeSubscription: Cancellable?

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        startSubscription()
    }
    
    func startSubscription() {
   
           activeSubscription = Network.shared.apollo.subscribe(subscription: MyUserSubscription()) { [weak self] result in
               guard self != nil else {
                   return
               }
               switch result {
               case .success(let graphQLResult):
                   if let user = graphQLResult.data?.newUser {
                       debugPrint(user.name)
                   }
                   if let errors = graphQLResult.errors {
                       debugPrint(errors[0].message ?? "Error")
                   }
               case .failure(let error):
                   debugPrint(error.localizedDescription)
               }
           }
       }

}

        let webSocket = WebSocket(
            url: URL(string: "wss://localhost:4000/graphql")!,
            protocol: .graphql_ws
        )

        let webSocketTransport = WebSocketTransport(websocket: webSocket)

        let splitTransport = SplitNetworkTransport(
            uploadingNetworkTransport: transport,
            webSocketNetworkTransport: webSocketTransport
        )

        return ApolloClient(networkTransport: splitTransport, store: store)
    }()
}

```

[Here](https://github.com/BraveEvidence/iossubscription/tree/main) is the complete repo

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [February 20, 2024, 6:00pm UTC](https://community.apollographql.com/t/the-operation-couldn-t-be-completed-osstatus-error-9847/7224/2 "2024-02-20T18:00:39Z")

</div>

For the benefit of others, we’ve taken up debugging this in a [repo issue](https://github.com/apollographql/apollo-ios/issues/3339). You can follow that for a resolution.
