Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Are there alternate methods for sending byte data from an iPad client to a PC server?

$
0
0
Hello everyone, this is an issue I am having to figure out. When I try to use an RPC call to send a byte array to a PC server from an iOS device(Macbook, ipad, etc.) the ios version will crash. I am using Unity 4.6.5. here are the functions involved in the process. IEnumerator TakePhoto() { yield return new WaitForEndOfFrame(); int resWidth = (int)pictureCamera.pixelWidth; int resHeight = (int)pictureCamera.pixelHeight; Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false); pictureCamera.Render(); screenShot.ReadPixels(new Rect(pictureCamera.pixelRect), 0, 0); byte[] bytes = screenShot.EncodeToPNG(); acceptedPicture = bytes; nView.RPC("RecievePhoto", RPCMode.Server, bytes); System.IO.File.WriteAllBytes(FilePath, bytes); } THis is just taking the picture and storing the bytes in a different byte array to be used when the RPC is called. [RPC] void RecievePhoto(byte[] bytes) { if (bytes.Length < 1) { Debug.Log("Recieved Bad byte count"); return; } string filePath = Application.dataPath + "/test.png"; System.IO.File.WriteAllBytes(FilePath, bytes); } That is the actual RPC function that get's called. I have done enough testing to know that the RPC call is the issue, not the function itself. However it works fine on a PC client. Does anyone have a solution so that this will work or an alternate method of doing it? I am aware of WWWForms and am looking into implementing those as a back up.

Viewing all articles
Browse latest Browse all 4709

Trending Articles