akofman / cordova-plugin-dbmeter

:microphone::mega: Cordova plugin to get decibels from the microphone
Apache License 2.0
35 stars 29 forks source link

Fixed modern Swift compatibility issues. #5

Closed gitbetter closed 6 years ago

gitbetter commented 7 years ago

The Swift file was throwing errors and the plugin was not compiling the file to reflect changes in the newer Swift versions. It now compiles and works like a charm. It should work for both iOS 9 and 10.

giaidieu commented 7 years ago

I compiled with Xcode 8.3.2 and it gave me error on run time at these lines: self.timer.setEventHandler(handler: self.timerCallBack()) self.timer.scheduleRepeating(deadline: .now(), interval: Double(NSEC_PER_SEC) / 300.0, leeway: .seconds(0))

Test with iPhone 6 Plus iOS 10.3.3.

Please help, thanks!

gitbetter commented 7 years ago

What is the error you're getting? Can you provide a stack trace?

giaidieu commented 7 years ago

Hi gitbetter,

To reproduce it, i do as followings:

Please let me know if you need any other info in order to debug it. I thought it could be because I call the DBMeter.start function before the device is in ready state mode but seems not. My code is clearly placed inside the onDeviceReady function:

onDeviceReady: function() {
    this.receivedEvent('deviceready');
DBMeter.start(function(dB){
  console.log(dB);
}, function(e){
  console.log('code: ' + e.code + ', message: ' + e.message);
});
},

Thanks!