Works in simulator but not on device...

I am using develephant’s modparse module to upload an image taken on a device to parse class.

Everything works great in the simulator using the webcam to capture the image, and then successfully sending it to parse. However, when testing on an iPhone, this does not work. I am saving the image to the documents directory, then referencing it in the upload function. There are no errors and I have tested that the image does exist in the documents directory. The device builds seems to simply ignore the upload process…

Is there something I am missing in regards to iOS images versus simulator (mac) builds? I am thinking it has to do something with the size or type of the image, due to the iSight camera on a mac being a lower image size. The other information I am uploading works fine, like text and numeric values.

I have built a temporary “console” window in the app to provide debugging feedback in device builds, but still not much luck.

It might be something simple, that the community here can share with me. Please share your thoughts. 

UPDATE: I used the JSON library to encode and output the upload function’s event to my fake console.

In simulator: image is transferred successfully. console shows 524,288 bytes transferred.

On device: image is not transferred successfully. Console shows 2,883,584 bytes transferred with status -1 and network error  true , and it repeats the upload call back continuously

My device is connected to a wifi network. Please help.

Hi,

Are you using mod_parse or the Parse Plugin?

Cheers.

I am using mod_parse (2.2.4) to assist in the implantation of users and file management. I am using your uploadFile function when receiving this error on device.

@develephant is there any values that I can provide you to help evaluate the issue?

Hi,

Do you happen to know the filetype? And approximate size of the image?

The upload method in mod_parse is basically just the network.upload from the Corona library.

Cheers.

@brian.gorham, If you are on iOS 9, please make sure to follow the Apple Transport Security : https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/  for all network API to work.

2.9 Mb file size. PNG image format

@develephant on your GitHub documentation for linkFile() you require 6 parameters (callback being optional) when calling the function, however, in your example it only shows 5 (callback being one). I believe this to be incorrect.

From GitHub:

:linkFile( objClass, objId, linkField, fileUriToLink, fileUriToLinkUrl [, callback] )

From GitHub example:

parse:linkFile( parse.USER, “user-object-id”, “avatar”, “1234567890abcdef-photo.png”, onLinkFile )

If I am reading this correctly, the fileUriToLinkUrl is missing from the example. 

UPDATE: I used the JSON library to encode and output the upload function’s event to my fake console.

In simulator: image is transferred successfully. console shows 524,288 bytes transferred.

On device: image is not transferred successfully. Console shows 2,883,584 bytes transferred with status -1 and network error  true , and it repeats the upload call back continuously

My device is connected to a wifi network. Please help.

Hi,

Are you using mod_parse or the Parse Plugin?

Cheers.

I am using mod_parse (2.2.4) to assist in the implantation of users and file management. I am using your uploadFile function when receiving this error on device.

@develephant is there any values that I can provide you to help evaluate the issue?

Hi,

Do you happen to know the filetype? And approximate size of the image?

The upload method in mod_parse is basically just the network.upload from the Corona library.

Cheers.

@brian.gorham, If you are on iOS 9, please make sure to follow the Apple Transport Security : https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/  for all network API to work.

2.9 Mb file size. PNG image format

@develephant on your GitHub documentation for linkFile() you require 6 parameters (callback being optional) when calling the function, however, in your example it only shows 5 (callback being one). I believe this to be incorrect.

From GitHub:

:linkFile( objClass, objId, linkField, fileUriToLink, fileUriToLinkUrl [, callback] )

From GitHub example:

parse:linkFile( parse.USER, “user-object-id”, “avatar”, “1234567890abcdef-photo.png”, onLinkFile )

If I am reading this correctly, the fileUriToLinkUrl is missing from the example.