I used to use this code to retrieve the iOS uptime using Xamarin's classic API:
var uptime = ObjCRuntime.Messaging.Double_objc_msgSend(NSProcessInfo.ProcessInfo.Handle,
new ObjCRuntime.Selector ("systemUptime").Handle);
var ts = TimeSpan.FromSeconds(uptime);
return ts;
I am trying to convert to the Unified API and now I am getting this build error for the above:-
Error CS0122: `ObjCRuntime.Messaging' is inaccessible due to its protection level (CS0122)
I am not sure how to convert this. Can anyone help?
Thanks in advance
The unified api has a ProcessInfo that is shared between iOS and OS-X
So using that with your code/variable names:
var uptime = Foundation.NSProcessInfo.ProcessInfo.SystemUptime;
var ts = TimeSpan.FromSeconds(uptime);
return ts;
Related
My iOS application creates a key using AES encryption and send it with all the APIs , and it is being decrypted at the server end, now after the update of OS 13.4 the key created from the device(not the simulator) is in incorrect and the following error is thrown by the server :
"Padding is invalid and cannot be removed."
It is working perfectly in the devices below 13.4 OS version , we are using CommonCrypto to encrypt the key at our end , following are the details :
let ivData = "passpharse".data(using:String.Encoding.utf8)!
let cryptLength = size_t(data.count + kCCBlockSizeAES128)
var cryptData = Data(count:cryptLength
let keyLength = size_t(kCCKeySizeAES128)
let options = CCOptions(kCCOptionPKCS7Padding)
var numBytesEncrypted :size_t = 0
The surprising part is that the key is being correctly generated for some API calls although same method is used for key generation.
Users with iOS - OS less than 13.4 are not facing any issue, If anyone have came across the same situation please guide.
thanks in advance.
After much research I made it work on all the versions.
if in the above code “passphrase” is shorted than 16 bytes, it uses whatever's in-memory past the end.
It seems like improper use of the CommonCrypto APIs was the issue here. Really don’t know why this worked before, but maybe we got lucky with the memory layout but the issues above need to be remedied before this will function as expected.
I am using https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc and I am having a hard time to allow ios 11 to work with internal blobs.
Do you have any idea how to configure cordova 7 (ios engine 4.5+) in order to make this works?
Thank you!
what actually fixed it for me was changing video.srcObject = stream; to video.src = window.URL.createObjectURL(stream);
I am writing my first ever mobile app for IOS using Xamarin and i need to use the camera to scan a product barcode similar to the function of many shopping apps. Would any of you lovely people know how i go about this or if there are any plug-ins for this?
Thanks
Steve
For the most part, I have found ZXing Mobile to be the best option as far as reading barcodes is concerned.
The syntax is very .NET friendly:
buttonScan.Click += (sender, e) => {
var scanner = new ZXing.Mobile.MobileBarcodeScanner();
var result = await scanner.Scan();
if (result != null)
Console.WriteLine("Scanned Barcode: " + result.Text);
};
Source and more info: https://components.xamarin.com/view/zxing.net.mobile
I am trying to upload so many files via Azure Blob Storage .NET api and using with the current latest version 4.0.1. In ASP.NET MVC application i use async action method to upload via await blobFile.UploadFromStreamAsync but it really doesn't work and even i don't see an exception. It silently stops in that method without success.
But if i change action method to none-async and upload via blobFile.UploadFromStream method then everything to works well. I may uploaded via async way with 1% success rate that means very very low stability.
Do you experience same thing ? Is it bug in Storage Api implementation ?
Here is short example. One is async and the other one is none async action methods. There is no any problem if i upload small files but problem appears on large downloads. In this example UploadBlobSec method upload in short time but UploadBlob takes endless time.
public async Task UploadBlob()
{
var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString);
var blobContainer = storageAccount.CreateCloudBlobClient().GetContainerReference("files");
var blobFile = blobContainer.GetBlockBlobReference("song.mp3");
using (var stream = new WebClient().OpenRead("http://apolyonstorage.blob.core.windows.net/files/e8b1a1fa-8791-44dc-92ce-1a67a62f7b0f.mp3"))
{
await blobFile.UploadFromStreamAsync(stream);
}
}
public void UploadBlobSec()
{
var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString);
var blobContainer = storageAccount.CreateCloudBlobClient().GetContainerReference("files");
var blobFile = blobContainer.GetBlockBlobReference("song.mp3");
using (var stream = new WebClient().OpenRead("http://apolyonstorage.blob.core.windows.net/files/e8b1a1fa-8791-44dc-92ce-1a67a62f7b0f.mp3"))
{
blobFile.UploadFromStream(stream);
}
}
Code snippet looks fine - although I am not sure what the application around it is doing. Have you turned on server logs to see what is happening server side? For large files you should see the async upload translated into a couple of PutBlocks and then a PutBlockList. If you don't see the PutBlockList them maybe something strange is happening in your application.
Then assuming you do see the operations in the server logs that obviously means the operations are occurring. At that point look at the E2ELatency numbers vs ServerLatency I think you will see a large difference with E2Latency being much higher as it incorporates the time spent client side - and it would be interesting to see if your client network could be contributing to the problem. For example on my connection the e2elatency on the first PutBlock was 1346 ms vs 137 for ServerLatency.
For more information on logging take a look here.
Jason
We are creating a audio video application which using webRTC. The problem is we are not able to show the stream spectrum for remote but for local we are able to.
// setup a analyzer
var analyser = audioCtx.createAnalyser();
analyser.smoothingTimeConstant = 0.0;
analyser.fftSize = 1024;
// get the average for the first channel
var array = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(array);
var average = getAverageVolume(array);
For local stream we are getting the frequency values inside the array, but for remote stream we are getting zero values inside the array.
If any help, will be greatly appreciated.
A similar issue is described here https://code.google.com/p/chromium/issues/detail?id=241543
Seems like we don't have any specific solution due to browser's issue.