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

We are developing iOS mobile app that uses Ricoh Theta API v.2.1. Some of our customers complains that they can’t take photos using our app though it works fine when they use Theta mobile app.
We can’t reproduce it, but maybe there is a chance you can advice to us something.
We have added logs and see that for our customer the request POST fails with the following NSURLErrorDomain error .

[23-09-26-14-57-52]: [RicohCamera::OSC]: <Api.Query.Task
	"CreateAt": "2023-09-26 18:57:50 +0000"
	"Duration": "2s"
	"Request": <URLRequest
		"URL": ""
		"Method": "POST"
		"Headers": {
			"Content-Length": "0"
		"CachePolicy": "UseProtocolCachePolicy"
	"Error": <Error
		"Domain": "NSURLErrorDomain"
		"Code": -1004
		"UserInfo": {
			"NSErrorFailingURLKey": ""
			"_kCFStreamErrorDomainKey": 1
			"_kCFStreamErrorCodeKey": 61
			"NSUnderlyingError": <Error
				"Domain": "kCFErrorDomainCFNetwork"
				"Code": -1004
				"UserInfo": {
					"_kCFStreamErrorCodeKey": 61
					"_NSURLErrorNWPathKey": "satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns"
					"_kCFStreamErrorDomainKey": 1
			"NSErrorFailingURLStringKey": ""
			"NSLocalizedDescription": "Could not connect to the server."

Additional info from customer:
Camera: Ricoh Theta SC2 for business
Camera’s serial #YP40133479
Camera’s firmware version: 6.52
Devices: Iphone 14 and iPad 9th Gen 10.2-inch
iOS version: 17.0.1
Steps we have tried to fix it:

  • Everything is up to date
  • Reset network settings
  • Reset camera
  • Granted permissions “connect to devices on your local network” permission
  • Uninstalled/reinstalled the our app app and enabled permission again
  • Checked local network settings for our app and it’s enabled

What is

The camera endpoint is a http, not https, right?

How is that URL getting introduced into the log? Is it from the camera?

This person solved the problem by switching the HTTP library to make the request .

@Mikhail I’m curious about headers. I don’t have total confidence here, but have you set

Content-Type to application/json;charset=utf-8

not text/json

Hello Craig! Thank you for your response.

What is ?

According to our logs we got this in response of the request POST I am not sure that this is from the camera, maybe it’s some iOS restrictions and iOS doesn’t allow to connect to Ricoh server

The camera endpoint is a http, not https, right?

Right, we use http, not https.

I’ve read the thread you mentioned and I am wondering maybe we should specify some values inside NSAppTransportSecurity dictionary in info.plist?
Please see all possible keys for this dictionary:

NSAppTransportSecurity : Dictionary {
    NSAllowsArbitraryLoads : Boolean
    NSAllowsArbitraryLoadsForMedia : Boolean
    NSAllowsArbitraryLoadsInWebContent : Boolean
    NSAllowsLocalNetworking : Boolean
    NSExceptionDomains : Dictionary {
        <domain-name-string> : Dictionary {
            NSIncludesSubdomains : Boolean
            NSExceptionAllowsInsecureHTTPLoads : Boolean
            NSExceptionMinimumTLSVersion : String
            NSExceptionRequiresForwardSecrecy : Boolean   
            NSRequiresCertificateTransparency : Boolean

I can ask our contacts at RICOH to see if they’ve seen this behavior before or have any advice. I suspect that unless it is a common problem, it will be tough to get proper advice as it will be difficult to replicate the problem.

There are many errors of this type on the apple developer forums. This one below indicates that a problem was occurring when switching between https and http. Although there is no solution posted, it may provide a clue as to how to replicate the problem.


Are you pushing the images up to the cloud using mobile data while the SC2B is connected to the iPhone with WiFi?

Are you pushing the images up to the cloud using mobile data while the SC2B is connected to the iPhone with WiFi?

No, we don’t do it.

We just tried to add NSAllowsArbitraryLoads = true and NSAllowsLocalNetworking = true in our info.plist and sent the new build to our customer who has this problem. I will keep you posted if it helps.

I can ask our contacts at RICOH to see if they’ve seen this behavior before or have any advice.

I believe it can be really helpful if they could provide what they specify for NSAppTransportSecurity in their info.plist for the Theta app. Thank you in advance!

Hello! Just want to update you that setting NSAllowsArbitraryLoads = true and NSAllowsLocalNetworking = true in info.plist didn’t resolve the problem for our customer.

Sorry, missed your post. Yes we set Content-Type to application/json;charset=utf-8.
Everything woks fine for 99% of our customers and for all our devices in development team. But 1% of customers complains because of this error

OK, thanks for confirming. And thanks for the information on how often it occurs. I will report this back to RICOH.

@jcasman , I’m rather puzzled by the error below. I don’t know why it would show

We can try Google searches on this type of behavior for iOS development in general. If that is coming from the THETA SC2B, it may provide a clue as to the source of the problem.

The theta-client has a demo for iOS Swift.

Is it possible to test theta-client demo-ios and see if the error can be replicated?

If the error can be replicated, you can then open an issue on GitHub for assistance.


For some reason, this is coming up on your app. The URL does not seem to be coming from the RICOH THETA.

"NSErrorFailingURLStringKey": ""

Hello Craig! We set the same options in info.plist as in Ricoh Demo app and it fixed the customer issue. We will observe the other customers and let you you know if it happens again. Thank you very much for your assistance!

1 Like

Thanks for letting us know the status. I noticed that the ricoh app also has

Hi @craig ! One of our customers again experiences this issue. According to his words he has started to get this errors after updating to iOS 17.4. Do you maybe know if there are some changes that’s need to be done (though can see no changes in this repo theta-client/demos/demo-ios/SdkSample/Info.plist at main · ricohapi/theta-client · GitHub )
Please also see logs that we were able to collect from the customer:

[24-03-14-14-13-12]: [RicohCamera::OSC]: <Api.Query.Task [
	CreateAt: 2024-03-14T14:13:12-0700,
	Duration: 0s,
	Request: <URLRequest [
		URL: "",
		Method: "GET",
		Headers: [
			"Content-Length": "0"
		CachePolicy: UseProtocolCachePolicy
	] >,
	Error: <NSError [
		Domain: "NSURLErrorDomain",
		Code: -1004,
		UserInfo: [
			"_kCFStreamErrorDomainKey": 1,
			"_kCFStreamErrorCodeKey": 61,
			"NSErrorFailingURLKey": "",
			"NSLocalizedDescription": "Could not connect to the server.",
			"NSErrorFailingURLStringKey": "",
			"NSUnderlyingError": <NSError [
				Domain: "kCFErrorDomainCFNetwork",
				Code: -1004,
				UserInfo: [
					"_kCFStreamErrorDomainKey": 1,
					"_NSURLErrorNWPathKey": satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, uses wifi,
					"_kCFStreamErrorCodeKey": 61
			] >
	] >
] >

@Mikhail I’m going to meet with a person I know at RICOH today and will report this.

“NSErrorFailingURLKey”: “”,

The URL should be http, not https

Is it possible that somehow a portion of the code is trying to use https?