<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Marc,<div><br></div><div>are you testing on the device or an emulator. Digging the error message the code &nbsp;-1001 implies "Request Time out”</div><div><br></div><div>Mind to try using curl directly to perform a multipart and if it success check on the emulator. If it works guess there is some connectivity issue&nbsp;</div><div><br></div><div>Let us know your findings</div><div><br></div><div>Thanks!</div><div>Christos</div><div><br></div><div><br></div><div>[1]&nbsp;<a href="http://stackoverflow.com/questions/19116016/what-is-the-right-way-to-post-multipart-form-data-using-curl">http://stackoverflow.com/questions/19116016/what-is-the-right-way-to-post-multipart-form-data-using-curl</a></div><div><br></div><div><br><div><div>On Nov 18, 2014, at 3:26 PM, Marc Pires &lt;<a href="mailto:marcpiresrj@gmail.com">marcpiresrj@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Guys, well, i'm developing an app that uses the 1.6 version &nbsp;of AeroGear. Everything is going very with except that i could not get an image (from a UIImageView) upload to work.<div><br></div><div>Here what i'm doing.</div><div><br></div><div>1) Get a user photo from camera ou library</div><div>2) Issue a save request to the api endpoint.</div><div><br></div><div>The problem i'm having is that i get the following error:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x79f01e00 {NSErrorFailingURLKey=http://&lt;Server IP&gt;/service/test/uploadios, NSErrorFailingURLStringKey=http://</b><b>http://&lt;Server IP&gt;/service/test/uploadios</b><b>, NSUnderlyingError=0x79fd9020 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b><br></b></div></div><div>Below is the code i'm using from this:&nbsp;</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">-(<span style="color:rgb(187,44,162)">void</span>)performPhotoUpload</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="">&nbsp; &nbsp;</span><span style="color:rgb(112,61,170)">NSString</span><span style=""> *webservicePref = [[</span><span style="color:rgb(112,61,170)">NSUserDefaults</span><span style=""> </span>standardUserDefaults<span style="">] </span>stringForKey<span style="">:</span><span style="color:rgb(209,47,27)">@"serviceUrlSetting"</span><span style="">];</span></div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(112,61,170)">NSURL</span> *projectsURL = [<span style="color:rgb(112,61,170)">NSURL</span> <span style="color:rgb(61,29,129)">URLWithString</span>:webservicePref];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(187,44,162)">id</span>&lt;<span style="color:rgb(79,129,135)">AGPipe</span>&gt; registrationPipe;</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp; &nbsp;&nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(79,129,135)">AGPipeline</span> *pipeline = [<span style="color:rgb(79,129,135)">AGPipeline</span> <span style="color:rgb(49,89,93)">pipelineWithBaseURL</span>:projectsURL];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; registrationPipe = [pipeline <span style="color:rgb(49,89,93)">pipe</span>:^(<span style="color:rgb(187,44,162)">id</span>&lt;<span style="color:rgb(79,129,135)">AGPipeConfig</span>&gt; config) {</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);"><span style="">&nbsp; &nbsp; &nbsp; &nbsp; [config </span><span style="color:rgb(49,89,93)">setName</span><span style="">:</span>@"/service/test/uploadios"<span style="">];</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; &nbsp; &nbsp; [config <span style="color:rgb(49,89,93)">setType</span>:<span style="color:rgb(209,47,27)">@"REST"</span>];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; }];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; [registrationPipe <span style="color:rgb(49,89,93)">save</span>:[<span style="color:rgb(187,44,162)">self</span> <span style="color:rgb(49,89,93)">extractMultiPartData</span>]</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(49,89,93)">success</span>:^(<span style="color:rgb(187,44,162)">id</span> responseObject)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(61,29,129)">NSLog</span>(<span style="color:rgb(209,47,27)">@"Returned Object:%@"</span>, responseObject);</div><p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="">&nbsp; &nbsp; &nbsp;&nbsp;</span></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; <span style="color:rgb(49,89,93)">failure</span>:^(<span style="color:rgb(112,61,170)">NSError</span> *error)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; {</div><p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(61,29,129)">NSLog</span>(<span style="color:rgb(209,47,27)">@"Error:%@"</span>,[error <span style="color:rgb(61,29,129)">description</span>]);</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; }];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">-(<span style="color:rgb(112,61,170)">NSDictionary</span> *)extractMultiPartData</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(112, 61, 170);"><span style="">&nbsp; &nbsp; </span>NSString<span style=""> *filename = </span><span style="color:rgb(187,44,162)">self</span><span style="">.</span><span style="color:rgb(79,129,135)">patientPhoto</span><span style="">.</span>accessibilityIdentifier<span style="">;</span></div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="">&nbsp; &nbsp; </span>//Check if an image was assigned for user</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; [<span style="color:rgb(187,44,162)">self</span> <span style="color:rgb(49,89,93)">hasPhoto</span>:filename];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(112,61,170)">NSData</span> *imageData = <span style="color:rgb(61,29,129)">UIImageJPEGRepresentation</span>(<span style="color:rgb(187,44,162)">self</span>.<span style="color:rgb(79,129,135)">patientPhoto</span>.<span style="color:rgb(112,61,170)">image</span>, <span style="color:rgb(39,42,216)">0.2</span>);</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(79,129,135)">AGFileDataPart</span> *dataPart = [[<span style="color:rgb(79,129,135)">AGFileDataPart</span> <span style="color:rgb(61,29,129)">alloc</span>] <span style="color:rgb(49,89,93)">initWithFileData</span>:imageData &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color:rgb(49,89,93)">name</span>: <span style="color:rgb(209,47,27)">@"image"</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(49,89,93)">fileName</span>:filename</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(49,89,93)">mimeType</span>:<span style="color:rgb(209,47,27)">@"application/octet-stream"</span>];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(112,61,170)">NSDictionary</span> *imgDict = <span style="color:rgb(39,42,216)">@{</span><span style="color:rgb(209,47,27)">@"data"</span>: dataPart<span style="color:rgb(39,42,216)">}</span>;</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp; &nbsp; <span style="color:rgb(187,44,162)">return</span> imgDict;</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Desenvolvedor IOS, Rails, RIA</div><div><br></div><div><a href="http://www.linkedin.com/in/marcpires" target="_blank">http://www.linkedin.com/in/marcpires</a><br></div><a href="http://about.me/marcelo_pires" target="_blank">http://about.me/marcelo_pires</a><br></div></div>
</div></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</blockquote></div><br></div></body></html>