Fixed iOS Simulator Crash

This commit is contained in:
Rody Davis 2018-08-16 11:15:26 -04:00
parent b8f6dfb6df
commit 4a15d251b3
4 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,7 @@
## 0.0.3
* Bug Fix for iOS Simulator Error
## 0.0.2
* Fixing Version

View File

@ -1,8 +1,6 @@
# flutter_sms
<p align="center">
<img src="https://github.com/AppleEducate/flutter_sms/blob/master/screenshots/ios_blank.PNG" width="400">
</p>
![alt-text-1](https://github.com/AppleEducate/flutter_sms/blob/master/screenshots/ios_blank.PNG)
## Description

View File

@ -16,12 +16,16 @@ public class SwiftFlutterSmsPlugin: NSObject, FlutterPlugin, UINavigationControl
_arguments = call.arguments as! [String : Any];
switch call.method {
case "sendSMS":
#if targetEnvironment(simulator)
result(FlutterError(code: "message_not_sent", message: "Cannot send message on this device!", details: "Cannot send SMS and MMS on a Simulator. Test on a real device."))
#else
let controller = MFMessageComposeViewController()
controller.body = _arguments["message"] as? String
controller.recipients = _arguments["recipients"] as? [String]
controller.messageComposeDelegate = self
UIApplication.shared.keyWindow?.rootViewController?.present(controller, animated: true, completion: nil)
result(message)
result(message)
#endif
default:
result(FlutterMethodNotImplemented)
break

View File

@ -1,6 +1,6 @@
name: flutter_sms
description: A Flutter plugin for Sending SMS on Android and iOS.
version: 0.0.2
description: A Flutter plugin to Send SMS and MMS on iOS and Android. If iMessage is enabled it will send as iMessage on iOS. This plugin must be tested on a real device on iOS.
version: 0.0.3
author: Rody Davis <rody.davis.jr@gmail.com>
homepage: https://github.com/AppleEducate/flutter_sms
environment:
@ -11,6 +11,7 @@ dependencies:
flutter:
sdk: flutter
# flutter packages pub publish
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec