NSURLErrorDomain when try to connect to camera using API v. 2.1

while connecting to the Theta camera through my iOS application.the user, who is on iOS version 17.4.1 is experiencing a timeout error with the following details:
Error Domain=NSURLErrorDomain Code=-1001 “The request timed out.” UserInfo={_kCFStreamErrorCodeKey=-2103, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3EC9BA23-7212-4579-85DD-00355DC28141>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
“LocalDataTask <3EC9BA23-7212-4579-85DD-00355DC28141>.<1>”
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://192.168.1.1/osc/info, NSErrorFailingURLKey=https://192.168.1.1/osc/info, _kCFStreamErrorDomainKey=4}

and camera Details :-
Firmware Version:2.51.0
Manufacturer: Ricoh Company, Ltd.
Model: RICOH THETA X

Interestingly,my camera works fine with the Theta app.
Thank you in advance for your assistance.

@Anjali_Nirmale sorry, I don’t have an iPhone and am not familiar with iOS development.

Perhaps you can open an issue on the theta-client GitHub repository.

While attempting to connect to the RICOH THETA X camera via Wi-Fi from my application, I encounter intermittent API failures. The camera details are as follows:

Firmware Version:2.51.0
Manufacturer: Ricoh Company, Ltd.
Model: RICOH THETA X
GPS: Enabled
Gyro: Enabled
Uptime: 32 seconds

Occasionally, the API calls fail with the following errors:

1.Error 1:**

Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." 
UserInfo={
    _kCFStreamErrorCodeKey=61, 
    NSUnderlyingError=0x2800e13b0 {
        Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" 
        UserInfo={
            _NSURLErrorNWPathKey=satisfied (Path is satisfied), 
            interface: en0[802.11], ipv4, dns, 
            _kCFStreamErrorCodeKey=61, 
            _kCFStreamErrorDomainKey=1
        }
    }, 
    _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <8409EE14-264C-4B78-9FAD-845E0A1C10DB>.<1>, 
    _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalDataTask <8409EE14-264C-4B78-9FAD-845E0A1C10DB>.<1>"
    ), 
    NSLocalizedDescription=Could not connect to the server., 
    NSErrorFailingURLStringKey=https://192.168.1.1/osc/info, 
    NSErrorFailingURLKey=https://192.168.1.1/osc/info, 
    _kCFStreamErrorDomainKey=1
}
  1. Error 2:
Error: Optional(Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." 
UserInfo={
    _kCFStreamErrorCodeKey=50, 
    NSUnderlyingError=0x300e4d0b0 {
        Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" 
        UserInfo={
            _NSURLErrorNWPathKey=unsatisfied (Local network prohibited), 
            interface: en0[802.11], ipv4, constrained, uses wifi, 
            _kCFStreamErrorCodeKey=50, 
            _kCFStreamErrorDomainKey=1
        }
    }, 
    _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <78703E09-9F17-4275-88A4-0A1EDC3D854D>.<1>, 
    _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalDataTask <78703E09-9F17-4275-88A4-0A1EDC3D854D>.<1>"
    ), 
    NSLocalizedDescription=The Internet connection appears to be offline., 
    NSErrorFailingURLStringKey=http://192.168.1.1/osc/info, 
    NSErrorFailingURLKey=http://192.168.1.1/osc/info, 
    _kCFStreamErrorDomainKey=1
})

I am looking for assistance in understanding and resolving these connectivity issues.

If on iOS, use theta-client as a reference.

Try use theta-client with your camera and mobile phone. If theta-client fails, then open an issue on GitHub. If it works, try to use the software as a reference.

1 Like

@Anjali_Nirmale Two quick questions about your Wi-Fi environment:

  • Are you testing in an area with multiple other networks? Some level of intermittent interference is possible if there are multiple networks nearby.
  • The X can connect over Wi-Fi at 2.4 GHz and 5 GHz frequency bands. Which are you currently using? If you connect at 5 GHz, it may help the connection stability.
2 Likes

@jcasman hi, when there are multiple other networks available, we sometimes encounter the “could not connect to server " error msg for extended period.
we are seeing the " The Internet connection appears to be offline” error when we connect to theta camera via WiFi? since communication with the theta camera doesn’t require internet access. I m curious about the reason behind this.

Correct, you are not connecting to the Internet. You are using Wi-Fi to connect to the THETA. But with other Wi-Fi networks in the area, there can be some level of interference.

@Anjali_Nirmale I don’t see any errors here. It looks to me like you are properly connected to your THETA. “No Internet Connection” is correct. You are connected to the THETA, not the Internet.

Here is an example from my iPhone 12, connecting to a THETA X. With this connection, I can control the THETA.

@jcasman yes. I agreed then sometimes these errors. happen…what do you think might be the root cause of these issues? I have tried to reproduce it with multiple network as well but it have been unable to do so

I think the best thing to try is to use theta-client to try and replicate the error and then open an issue on GitHub.

I’m not an experienced iOS developer, so I can’t be of too much assistance. I think we’ll either need to wait for someone from the community, or you can establish community with RICOH engineers on GitHub.

I’ve been searching Stackoverflow and found the question below. However, be aware that I do not develop with iOS.

2 Likes

The best issue for GitHub is if she can replicate the problem with the theta-client iOS version.

This is the main reason I was suggesting that we get an intern to test this in different scenarios

Example test ideas for theta-client

  • camera is on default sleep or shorter and we test what happens when camera wakes up from sleep
  • camera is on 2.4GHz, then at 5GHz
  • run test about 10 times when 5 API calls per test (50 API calls in total)
  • research the NSURLErrorDomain and attempt to replicate with theta-client
1 Like

@jcasman yes…works fine with Ricoh theta app.

OK, thank you for confirming. I have the meeting with RICOH today, I’ll keep you updated on any new information.

1 Like

It seems like the implication is that there is some security configuration in iOS development to allow more stable non-secure “http” instead of defaulting to “https” when some event occurs. We can speculate that the event is something like “loss of connection to the THETA X”. However, this is just a speculation.

We can speculate on possible causes by using ChatGPT.


Below is from ChatGPT.

When developing for iOS, your app attempts to use HTTPS instead of HTTP due to Apple’s App Transport Security (ATS) policy, which was introduced to enhance the security of network connections in iOS apps. Here are some key points about ATS:

  1. App Transport Security (ATS): Introduced in iOS 9, ATS enforces secure connections between an app and the web services it communicates with. This means that by default, iOS apps are required to use HTTPS connections to ensure data is encrypted in transit, protecting it from interception and tampering.

  2. Security Enhancements: HTTPS ensures that the data sent and received by your app is encrypted, providing confidentiality and integrity. It helps protect user information from being accessed by malicious actors.

  3. ATS Requirements: ATS requires the use of TLS (Transport Layer Security) with specific configurations, such as:

    • Minimum TLS version of 1.2
    • Strong cipher suites
    • Valid certificates signed by trusted certificate authorities (CAs)
  4. Configuring ATS Exceptions: While ATS is the default, you can configure exceptions in your app’s Info.plist file if you need to connect to a server that does not support HTTPS. However, this is generally discouraged as it reduces the security of your app.

Here’s an example of how to configure an exception in the Info.plist file to allow HTTP connections:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Or, to allow HTTP connections to specific domains:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

It’s important to note that while you can configure exceptions, it’s best to use HTTPS whenever possible to ensure the security of your users’ data.

1 Like

@Craig hi thanks for always responding promptly and investing time in troubleshooting this with me… but I already added all that info.plist so that app can communicate with the app…some user is experience this issue more after updating the new 17.4.1 iOS…still checking why this happing.

@jcasman when you report to RICOH, make note that Mikhail also reported the problem is November of 2023 and also in March of 2024. So, if there is a way to provide assistance, it would be useful to at least two commercial developers building real-world apps. It’s a difficult problem as it does not appear to be consistent.

2 Likes

@Anjali_Nirmale were you able to get this resolved? Or, are you still not getting reliable communication between the THETA X and iOS?