Uploading Multiple images on Box from iOS application - ios

I am currently working on an iOS application in which i have to upload multiple images on Box,after authentication process. when i select more than 5 images at a time it always upload 5 images and more than 5 images stop uploading. Error messages comes on the log like::
[BoxAPIOperation connectionDidFinishLoading:]: BoxAPIOperation <BoxAPIMultipartToJSONOperation: 0xa64eb20> POST https://upload.box.com/api/2.1/files/content did finsh loading
2014-08-25 12:53:36.484 Pbm[13499:4903] -[BoxAPIOperation finish]: BoxAPIOperation <BoxAPIMultipartToJSONOperation: 0xa64eb20> POST https://upload.box.com/api/2.1/files/content finished with state 3
2014-08-25 12:53:36.485 Pbm[13499:4903] -[BoxAPIOperation connection:didFailWithError:]: BoxAPIOperation <BoxAPIMultipartToJSONOperation: 0xa642d00> POST https://upload.box.com/api/2.1/files/content did fail with error Error Domain=NSURLErrorDomain Code=-1021 "request body stream exhausted" UserInfo=0xa334970 {NSErrorFailingURLStringKey=https://upload.box.com/api/2.1/files/content, NSErrorFailingURLKey=https://upload.box.com/api/2.1/files/content, NSLocalizedDescription=request body stream exhausted, NSUnderlyingError=0xa32fb70 "request body stream exhausted"}
2014-08-25 12:53:36.485 Pbm[13499:4903] response : (null)
2014-08-25 12:53:36.485 Pbm[13499:4903] error : Error Domain=NSURLErrorDomain Code=-1021 "request body stream exhausted" UserInfo=0xa334970 {NSErrorFailingURLStringKey=https://upload.box.com/api/2.1/files/content, NSErrorFailingURLKey=https://upload.box.com/api/2.1/files/content, NSLocalizedDescription=request body stream exhausted, NSUnderlyingError=0xa32fb70 "request body stream exhausted"}
i am not getting the issue for "request body stream exhausted" . Please help me out if any body had done the uploading process on Box.
Thanks in advance.

Related

ASP.NET Core 3.1 errors time out after Start processing HTTP request POST

I have a time out exception just after the "Start processing HTTP request POST" of HttpClientFactory
when does this message occurs exactly , is it before or after calling the server?
info: System.Net.Http.HttpClient.MyClient.LogicalHandler[100]
Start processing HTTP request GET https://api.github.com/repos/aspnet/docs/branches
ritical : System.Net.Http.HttpRequestException : Connection timed out

Microsoft Speech API - Cognitive Speech STT iOS : Language not changing

I have started recognition using
_micClient = [SpeechRecognitionServiceFactory createMicrophoneClient:SpeechRecognitionMode_ShortPhrase withLanguage:locale withKey:API_KEY withProtocol:(self)];
Everything worked as intended.
But, second time using the same with another locale, recognition is only in the first language.
Eg: App launched and starts recognition with "hi-IN"
Application Name: com.XXXX.XXXX/1.0.1 STS:
https://api.cognitive.microsoft.com/sts/v1.0/issueToken Refreshing
token /sts/v1.0/issueToken Initializing Audio Services Initializing
Speech Services No application id provided to controller
GetIdentityPropertyValue 3 Useragent Value iOS Assistant (iOS;
11.2.6;Mobile;ProcessName/AppName=com.XXXX.XXXX/1.0.1;DeviceType=Near;SpeechClient=1.0.161216)
Url: 'https://websockets.platform.bing.com/ws/speech/recognize'
Locale: 'hi-IN' Application Id: '' Version: 4.0.150429
UserAuthorizationToken: ServerLoggingLevel: 1 Initiating websocket
connection. m_connection=0x0 host=websockets.platform.bing.com
port=443 Auth token status: 200 Authorization token hr 0 'Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6Imh0dHBzOi8vc3BlZWNoLnBsYXRmb3JtLmJpbmcuY29tIiwic3Vic2NyaXB0aW9uLWlkIjoiMGZhNGQ5NmZjODc5NDA1ZmIyZDc3ZGVmY2NiOTc0MzUiLCJwcm9kdWN0LWlkIjoiQmluZy5TcGVlY2guUzAiLCJjb2duaXRpdmUtc2VydmljZXMtZW5kcG9pbnQiOiJodHRwczovL2FwaS5jb2duaXRpdmUubWljcm9zb2Z0LmNvbS9pbnRlcm5hbC92MS4wLyIsImF6dXJlLXJlc291cmNlLWlkIjoiL3N1YnNjcmlwdGlvbnMvZjJmNWJmMGYtZTRlOC00NDY1LTg4ZDQtYmMyMGFiYTNmMTIzL3Jlc291cmNlR3JvdXBzL1NwZWVjaFJlY29nbml0aW9uL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29nbml0aXZlU2VydmljZXMvYWNjb3VudHMvU3BhcmtsaW5nU3BlZWNoIiwiaXNzIjoidXJuOm1zLmNvZ25pdGl2ZXNlcnZpY2VzIiwiYXVkIjoidXJuOm1zLnNwZWVjaCIsImV4cCI6MTUyMjkyODc1OH0.PTBvhZ18q__-PCJRtWLr-KkQ99yt4c-mnrd2kdyOn1c'
Successfully initialized client connection Create ImpressionId:
fff94b5814ae9a097f0d749c137069d9 Create ImpressionId:
01eb6b249fc1d90e37ba61a1a2d64fe9 Reset
Create ImpressionId: e69685c047daf66ef0887614b2a35fc4 ImpressionId:
b53b312c6dfd13609e5b1cf2952f0af6 Adding requestId:
'cadbb055d5d4ef5c669d210a5fed2bf7' for 'text/cu.client.context'
Subscribing request [cadbb055d5d4ef5c669d210a5fed2bf7] Audio stream
created Adding requestId: 'e9012ec9fe3d9ee9e8a075e6274eda06' for
'audio/x-wav' Subscribing request [e9012ec9fe3d9ee9e8a075e6274eda06]
Audio Stream Created Creating transcoder 2
Upgrade request returned with HTTP status code: 101 Web socket
handshake completed CU Client connected ConnectionStateChanged
Microphone permissions: 0 Sent first chunk of audio stream,
requestId='e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Speech recording
started Speech recording started OnDataAvailable: 81 => type 1
Received message: 'audio.stream.response' Response request id:
'e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Response impression:
'b53b312c6dfd13609e5b1cf2952f0af6'
LanguageGeneration OK Partial : आप OnDataAvailable: 81 => type 1
Received message: 'audio.stream.response' Response request id:
'e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Response impression:
'b53b312c6dfd13609e5b1cf2952f0af6'
LanguageGeneration OK Partial : आपके OnDataAvailable: 81 => type 1
Received message: 'audio.stream.response' Response request id:
'e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Response impression:
'b53b312c6dfd13609e5b1cf2952f0af6'
LanguageGeneration OK Partial : आप किस OnDataAvailable: 81 => type 1
Received message: 'audio.stream.response' Response request id:
'e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Response impression:
'b53b312c6dfd13609e5b1cf2952f0af6'
LanguageGeneration OK Partial : आप कैसे OnDataAvailable: 01 => type 1
Received message: 'audio.stream.response' Response request id:
'e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Response impression:
'b53b312c6dfd13609e5b1cf2952f0af6'
LanguageGeneration OK
Sending audio stream endpoint,
requestId='e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' Sent audio stream
endpoint, requestId='e9012ec9-fe3d-9ee9-e8a0-75e6274eda06' signaling
OnAudioEvent(AUDIO_EVENT_RECORD_STOP)
Then initialises new microphone client with "en-US".
Now when recognition starts:
Create ImpressionId: 0eed72b0b8019f0d7647b4d5d1adc8c6 Reset Canceling
request [cadbb055d5d4ef5c669d210a5fed2bf7] Canceling request
[e9012ec9fe3d9ee9e8a075e6274eda06]
Create ImpressionId: ff9306c014eba5a9da0fa5979269bced ImpressionId:
04bfd4c2fce0e631c6b6d9f3d16877f2 Adding requestId:
'b9148688143a0a9526df6bd9e31110d1' for 'text/cu.client.context'
Subscribing request [b9148688143a0a9526df6bd9e31110d1] Audio stream
created Adding requestId: '158b5857d7f60759687076b3bfa9d2bc' for
'audio/x-wav' Subscribing request [158b5857d7f60759687076b3bfa9d2bc]
Audio Stream Created Creating transcoder 2
Microphone permissions: 0 Speech recording started Speech recording
started Sent first chunk of audio stream,
requestId='158b5857-d7f6-0759-6870-76b3bfa9d2bc'
Sending audio stream endpoint,
requestId='158b5857-d7f6-0759-6870-76b3bfa9d2bc' Sent audio stream
endpoint, requestId='158b5857-d7f6-0759-6870-76b3bfa9d2bc' signaling
OnAudioEvent(AUDIO_EVENT_RECORD_STOP) Speech recording stopped Speech
recording stopped OnDataAvailable: 81 => type 1 Received message:
'audio.stream.response' Response request id:
'158b5857-d7f6-0759-6870-76b3bfa9d2bc' Response impression:
'04bfd4c2fce0e631c6b6d9f3d16877f2'
LanguageGeneration OK Partial : तो OnDataAvailable: 81 => type 1
Received message: 'audio.stream.response' Response request id:
'158b5857-d7f6-0759-6870-76b3bfa9d2bc' Response impression:
'04bfd4c2fce0e631c6b6d9f3d16877f2'
LanguageGeneration OK originating error 0x80070057 ERROR: No Reco
originating error 0x80070057
Couldn't find the locale in the log the second time and note that the partial responses are still in "hi-IN". Is there any way to remove old language configurations?
The websocket connection must be closed between one utterance and the next if you wish to change the language. Just waiting 3 minutes between utterances with no activity during the 3 minutes will close the connection. Also, calling AudioStop() should close the connection. If you already tried calling AudioStop() and that did not work, we will ensure this is fixed in upcoming versions of the released API .

HTTP load failed (error code: -1005) iOS

In my app, I use Alamofire to fetch data from my server. For each time I fetch, 10 results will be sent from my server to my app. If I only post 3 requests or less at the same time, no any issue. If I post 5 or more requests at the same time, I received below error (1). After about 60s, I received below error (2). I am wondering this is my server issue or ?? Any suggestions? Thanks.
error(1) - 1005
2017-11-25 17:12:31.645624+0800 LeanCloudStarter[2044:84112] Task <520034AA-B195-4354-ADB6-3544C5907E22>.<69> HTTP load failed (error code: -1005 [4:-4])
2017-11-25 17:12:31.646056+0800 LeanCloudStarter[2044:83813] Task <520034AA-B195-4354-ADB6-3544C5907E22>.<69> finished with error - code: -1005
error(2) - 1001
2017-11-25 20:59:42.370155+0800 LeanCloudStarter[4098:180387] TIC TCP Conn Failed [110:0x600000172fc0]: 1:60 Err(60)
2017-11-25 20:59:42.370640+0800 LeanCloudStarter[4098:180387] Task <A951A3F1-B8B3-415B-9BBA-AFDF039A57C3>.<125> HTTP load failed (error code: -1001 [1:60])
2017-11-25 20:59:42.371383+0800 LeanCloudStarter[4098:180306] Task <A951A3F1-B8B3-415B-9BBA-AFDF039A57C3>.<125> finished with error - code: -1001

Not able to run Microsoft Bing Speech Recognition API on iOS device using iOS Client Sample provided by Microsoft

I was trying to explore Microsoft's Bing Speech Recognition API for iOS https://github.com/Microsoft/Cognitive-Speech-STT-iOS. I followed all the steps written in the read me. The app runs and it seems to be detecting the speech from microphone and sending it to the Microsoft server but it gives an error in the logs and the button disables itself without giving any text on the app.
Here are the logs that came in the console. Please help.
Application Name: com.Microsoft.SpeechRecognitionServerExample/1.0.1
Refreshing token /sts/v1.0/issueToken
Initializing Audio Services
Initializing Speech Services
No application id provided to controller
GetIdentityPropertyValue 3
Useragent Value iOS Assistant (iOS; 10.0.1;Mobile;ProcessName/AppName=com.Microsoft.SpeechRecognitionServerExample/1.0.1;DeviceType=Near;SpeechClient=1.0.160824)
Url: 'https://websockets.platform.bing.com/ws/speech/recognize'
Locale: 'en-us'
Application Id: ''
Version: 4.0.150429
UserAuthorizationToken:
ServerLoggingLevel: 1
Initiating websocket connection. m_connection=0x0 host=websockets.platform.bing.com port=443
Auth token status: 200
Authorization token hr 0 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6Imh0dHBzOi8vc3BlZWNoLnBsYXRmb3JtLmJpbmcuY29tIiwic3Vic2NyaXB0aW9uLWlkIjoiZmNlYThiNTE3NGZmNDdkODk4ZWZiN2ZjYzNjZjM4MzMiLCJwcm9kdWN0LWlkIjoiQmluZy5TcGVlY2guUHJldmlldyIsImNvZ25pdGl2ZS1zZXJ2aWNlcy1lbmRwb2ludCI6Imh0dHBzOi8vYXBpLmNvZ25pdGl2ZS5taWNyb3NvZnQuY29tL2ludGVybmFsL3YxLjAvIiwiYXp1cmUtcmVzb3VyY2UtaWQiOiIiLCJpc3MiOiJ1cm46bXMuY29nbml0aXZlc2VydmljZXMiLCJhdWQiOiJ1cm46bXMuc3BlZWNoIiwiZXhwIjoxNDc1NDg3MDQ1fQ.4LF0gyhXU0T1iwDahlYlanKJ_wVjOOLhLyalFeDqIzA'
Successfully initialized client connection
Create ImpressionId: f43586374f8d8e455e48b090f2aaa5cd
Create ImpressionId: f627a603daa0cd4a16f59d9581118cdd
Reset
Create ImpressionId: dad2c09e82b8eaaacec3b20890de9bb8
ImpressionId: a9776c0ba8dc079c7d9658e6746a46ea
Adding requestId: 'bf17eb3310b2e39944d85dfe3d2868eb' for 'text/cu.client.context'
Subscribing request [bf17eb3310b2e39944d85dfe3d2868eb]
Waiting for connection/send completion.
Audio stream created
Adding requestId: 'dd3d699f39139326bedbb1dafd8816fb' for 'audio/x-wav'
Subscribing request [dd3d699f39139326bedbb1dafd8816fb]
Audio Stream Created
Creating transcoder 2
Microphone permissions: 0
Upgrade request returned with HTTP status code: 101.
Web socket handshake completed
CU Client connected
ConnectionStateChanged
Sent first chunk of audio stream, requestId='dd3d699f-3913-9326-bedb-b1dafd8816fb'
Received message: 'audio.stream.response'
Response request id: 'dd3d699f-3913-9326-bedb-b1dafd8816fb'
Response impression: 'a9776c0b-a8dc-079c-7d96-58e6746a46ea'
LanguageGeneration OK
Received message: 'audio.stream.response'
Response request id: 'dd3d699f-3913-9326-bedb-b1dafd8816fb'
Response impression: 'a9776c0b-a8dc-079c-7d96-58e6746a46ea'
LanguageGeneration OK
Received message: 'audio.stream.response'
Response request id: 'dd3d699f-3913-9326-bedb-b1dafd8816fb'
Response impression: 'a9776c0b-a8dc-079c-7d96-58e6746a46ea'
LanguageGeneration OK
Received message: 'audio.stream.response'
Response request id: 'dd3d699f-3913-9326-bedb-b1dafd8816fb'
Response impression: 'a9776c0ba8dc079c7d9658e6746a46ea'
Response Conversation: 'ab7082f3c4de8feb0d6210e8ec07dcb3'
LanguageGeneration OK
Sending audio stream endpoint, requestId='dd3d699f-3913-9326-bedb-b1dafd8816fb'
Sent audio stream endpoint, requestId='dd3d699f-3913-9326-bedb-b1dafd8816fb'
signaling OnAudioEvent(AUDIO_EVENT_RECORD_STOP)
originating error 0x80070057
Client UPL: 32880000 ticks
originating error 0x8000ffff
originating error 0x80070057
originating error 0x80004005
originating error 0x80004005
Failed to 'hresult', HR=80004005, WebSocket connection failed
No messages to retry, closing.
Closing web socket channel
CU Client connection dropped
ConnectionStateChanged
WebSocket closed unexpectedly, status: 0
Web socket channel already closed.

iOS app times out on error instead of processing it

In the RestKit app I'm making the requests and responses are working happily, but now I'm trying to add error handling. I'm following the example in the RestKit readme and similar examples from the net, but run into some strange behaviour.
The error mapping is added with
// Error JSON looks like {"errors": "Some Error Has Occurred"}
RKObjectMapping *errorMapping = [RKObjectMapping mappingForClass:[RKErrorMessage class]];
// The entire value at the source key path containing the errors maps to the message
[errorMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:nil toKeyPath:#"errorMessage"]];
NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassClientError);
// Any response in the 4xx status code range with an "errors" key path uses this mapping
RKResponseDescriptor *errorDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:errorMapping method:RKRequestMethodAny pathPattern:nil keyPath:#"errors" statusCodes:statusCodes];
[objectManager addResponseDescriptor:errorDescriptor];
When I make my service simulate an error instead of returning data, the following happens. The response of my service is
HTTP/1.1 401 Unauthorized
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 26 May 2015 19:01:21 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: application/json; charset=utf-8
Connection: Close
{"errors":"This is a test exception"}
after which the connection is closed. On the client side, however, the failure block of getObjectsAtPath: isn't executed immediately. Instead the function waits for a timeout and doesn't return an error object. The error is [Updated. Replaced with log including trace logging]:
2015-05-27 14:08:25.968 Olive Oil[37455:37884261] I restkit:RKLog.m:49 RestKit logging initialized...
2015-05-27 14:08:26.275 Olive Oil[37455:37884261] 320.000000
2015-05-27 14:08:26.415 Olive Oil[37455:37884261] T restkit.network:RKObjectRequestOperation.m:148 GET 'http://192.168.69.88/OliveOil.svc/recipies':
request.headers={
"Accept-Language" = "en;q=1";
Authorization = "Basic XXXXXXXXXXXXX==";
"User-Agent" = "Olive Oil/1 (iPad Simulator; iOS 8.3; Scale/2.00)";
}
request.body=(null)
2015-05-27 14:09:33.559 Olive Oil[37455:37885022] E restkit.network:RKObjectRequestOperation.m:544 Object request failed: Underlying HTTP request operation failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x7f91f36ad440 {NSUnderlyingError=0x7f91f37271e0 "The request timed out.", NSErrorFailingURLStringKey=http://192.168.69.88/OliveOil.svc/recipies, NSErrorFailingURLKey=http://192.168.69.88/OliveOil.svc/recipies, NSLocalizedDescription=The request timed out.}
2015-05-27 14:09:33.559 Olive Oil[37455:37885022] E restkit.network:RKObjectRequestOperation.m:209 GET 'http://192.168.69.88/OliveOil.svc/recipies' (401 Unauthorized / 0 objects) [request=67.1418s mapping=0.0000s total=67.2429s]:error=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x7f91f36ad440 {NSUnderlyingError=0x7f91f37271e0 "The request timed out.", NSErrorFailingURLStringKey=http://192.168.69.88/OliveOil.svc/recipies, NSErrorFailingURLKey=http://192.168.69.88/OliveOil.svc/recipies, NSLocalizedDescription=The request timed out.}
2015-05-27 14:09:33.560 Olive Oil[37455:37885022] D restkit.network:RKObjectRequestOperation.m:210 response.body=(null)
So apparently the status 401 gets communicated (2nd error), but something makes the RestKit wait for more data. What could be the cause of this behaviour? Some misconfiguration? Is the service response malformed? Is there something wrong with the error mapping?
On the service side, the connection wasn't closed after the data was sent.
After making the appropriate changes, the app processes the error information as expected. Thanks, Wain, for pointing me in the right direction.

Resources