My environment:
permission_handler 3.0.0
Flutter v1.2.1
OSX High Sierra 10.13.6
Xcode version 10.1.
My app is crashing when I request the permission for microphone in the iOS simulator.
PermissionStatus mic = await PermissionHandler()
.checkPermissionStatus(PermissionGroup.microphone);
print('microphone permission? ${mic.toString()}');
try {
if (mic != PermissionStatus.granted) {
await PermissionHandler().requestPermissions([PermissionGroup.microphone]);
}
} catch (e) {
print(e);
}
No error is thrown or caught, but in the flutter debug console, I see:
flutter: microphone permission? PermissionStatus.unknown
Lost connection to device.
This means that checkPermissionStatus() returned unknown. But then when I request the permission, the application crashes. I have not been able to try this on a real iPhone. Everything works perfectly on the Android simulator.
I've seen there were some problems in Xcode 10.1 with the microphone:
iOS Simulator would like to access microphone every time
Repeated request for microphone permission on iOS Simulator
What I've tried
Fresh build with flutter clean
Changing the simulator microphone input in Hardware > Audio Input
I could try to upgrade to Xcode 10.2, but I'd need to get mojave first. Trying to avoid that if possible as it might not even fix the issue. I can also try using a real iPhone device instead of the simulator. Would love to get the simulator not crashing, though.
Is anyone able to grant microphone permission in Xcode 10.1/10.2 simulator using permission_handler: 3.0.0? What about another flutter permission plugin?
Please make sure you have added the correct entries to the Info.plist file (for Flutter projects this file is located in the ios/Runner/ folder).
To access the microphone you will need to add the following lines in between the <dict> tags:
<key>NSMicrophoneUsageDescription</key>
<string>this application needs access to the microphone</string>
More information can be found here.
And a complete example of an Info.plist can be found here.
Related
I have tested the application on Testflight and as soon as I open it everything works correctly. The problem comes when I close the app and open it again, at that moment the application crashed and does not let me open it anymore.
I am testing on my iphone 6s with iOS 13.1.3.
Can anyone help me, please?
The App Center SDKs work well for capturing crash information. You can then see it in the App Center Portal
I have already added AppCenter to the project, and now I can see the analytics, but it doesn't catch me crash error.
About the configuration of AppCenter, I have added to the AppDelegate.cs (FinishedLaunching)
AppCenter.Start("bxxxxxxxxxxxxxxxxxxxxxxxxxxx3a0",
typeof(Analytics), typeof(Crashes));
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);
Crashes.SetEnabledAsync(true);
And to the App.xaml.cs
AppCenter.LogLevel = LogLevel.Verbose;
AppCenter.Start("ios=b41cxxxxxxxxxxxxxxxxxxxxxxxxxx0;" +
"uwp={Your UWP App secret here};" +
"android={Your Android App secret here}",
typeof(Analytics), typeof(Crashes));
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);
I test the Crashes.GenerateTestCrash on the simulator and It works, but exaclty the iPhone crash no
I need to detect, if an app is running on an iOS or Android emulator to skip an QR code scan method and just return a scanned code.
Q: How do I detect
on which device type - iOS or Android - an app is running and
if an app is running on an emulator?
Just found this plugin, which prints various details:
https://pub.dartlang.org/packages/device_info#-readme-tab-
Output on Android emulator [see last line]:
safe_device: ^1.1.1
import 'package:safe_device/safe_device.dart';
Checks whether device is real or emulator
bool isRealDevice = await SafeDevice.isRealDevice;
(ANDROID ONLY) Check if development Options is enable on device
bool isDevelopmentModeEnable = await SafeDevice.isDevelopmentModeEnable;
There is an exception throwing somewhere in the codebase of my flutter application.
However this is what the console output:
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
// (nothing, should be printing stack-trace or error message here)
Not having the stack-trace makes it very hard to find where this bug is coming from.
Does anyone know if it is normal that the stack-trace or the error message does not print?
Is there a mode in which I should run flutter run in order to see more information about the error being thrown?
Setup :
flutter: 0.2.8
running on an iphone device
One insight to obtuse ios physical device / flutter errors is review the the physical device console and device logs. In my case, I'm using an iphone 6S trying to work on a camera app.
The logs are available via Xcode --> Window --> Devices and Simulators --> choose Devices, then select either "View Device Logs" or "Open Console" button. Select the button for "Errors and Faults" to make this a bit easier.
In my case I discovered an error in camera permissions that wasn't visible at all from my development environment. The app just crashed, I had no clue why... Then I found this in the log...
error 21:51:03.438135 -0700 tccd Refusing TCCAccessRequest for service kTCCServiceCamera and client /var/containers/Bundle/Application/A817FC3E-F55D-46F5-9EF2-372E4FC90B1B/Runner.app[319] without NSCameraUsageDescription key
error 21:51:03.476854 -0700 Runner This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
The fix for my camera dilemma on the iPhone is as follows:
Find the Info.plist file (Location = flutter_image_picker/ios/Runner/Info.plist )
Add the following key/string pair:
<key>NSCameraUsageDescription</key>
<string>Camera used to take photos in support of the app.</string>
All fixed!
I am using opentok in my Hybrid ionic app for live streaming.
I am facing issue that I am unable to see live streaming in ios app, although its working on my android app which is already published on Google Play,
Now I need to publish my ios app but I am stuck with these errors showing in Xcode
"ERROR: OT.Publisher.onStreamAvailableError OT_MEDIA_ERR_ABORTED: Argument 1 ('mediaStream') to webkitAudioContext.createMediaStreamSource must be an instance of MediaStream"
"ERROR: OT.exception :: title: Unable to Publish (1500) msg: GetUserMedia"
Device I am using is iPhone 6 (OS 11.0, Safari 11.0)
I had same problem.
For me, problem was in publisher options for OT.initPublisher.
Option "resolution" was redundant. It crashed everythin for ios only, I commented it -ant everything is ok now. Good luck!
You can use the Cordova OpenTok Plugin to add live video to your Ionic applications:
https://github.com/opentok/cordova-plugin-opentok/
The plugin allows you to publish, subscribe, and use the OpenTok Signaling API on both iOS and Android. For Ionic samples, take a look at the following repo: https://github.com/opentok/opentok-ionic-samples
If Mobile Safari crashes in the iOS Simulator, where can the crash logs be found?
(Apple will want these attached to your bug reports.)
Look for files named MobileSafari_*.crash in ~/Library/Logs/DiagnosticReports/.
(Execute open ~/Library/Logs/DiagnosticReports/ in Terminal, then sort by date modified.)