Hi all,
Trying compile my app, generates an error in Xcode. My app works fine
till I add sms_advanced plugin, I use exactly the code given in sample
example for sending sms via IPHONE (IOS build).
Here are flutter doctor, logs of compile and code used to send an SMS.
Flutter doctor : Flutter doctor log: % flutter doctor Doctor summary
(to see all details, run flutter doctor -v): [✓] Flutter (Channel
master, 2.6.0-12.0.pre.837, on macOS 11.6.1 20G224 darwin-arm, locale
en-FR) [✓] Android toolchain - develop for Android devices (Android
SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.1)
[✓] Chrome - develop for the web [✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.62.3) [✓] Connected device (2 available)
Compile log:
Running Xcode build... Xcode build done. 11.1s Failed to build iOS app
Error output from Xcode build: ↳
** BUILD FAILED **
Xcode's output: ↳
/Users/theUser/.pub-cache/hosted/pub.dartlang.org/sms_advanced-1.0.1/ios/Classes/SmsAdvancedPlugin.m:13:4:
error: unknown receiver 'SwiftSmsAdvancedPlugin'; did you mean
'SmsAdvancedPlugin'? [SwiftSmsAdvancedPlugin
registerWithRegistrar:registrar]; ^~~~~~~~~~~~~~~~~~~~~~
SmsAdvancedPlugin In file included from
/Users/theUser/.pub-cache/hosted/pub.dartlang.org/sms_advanced-1.0.1/ios/Classes/SmsAdvancedPlugin.m:1:
/Users/theUser/.pub-cache/hosted/pub.dartlang.org/sms_advanced-1.0.1/ios/Classes/SmsAdvancedPlugin.h:3:12:
note: 'SmsAdvancedPlugin' declared here #interface SmsAdvancedPlugin :
NSObject ^ 1 error generated. note: Using new build system note:
Planning note: Build preparation complete note: Building targets in
parallel
Could not build the precompiled application for the device.
Error launching application on iPhone.
SAMPLE CODE:
void main() {
SmsSender sender = new SmsSender();
String address = someAddress();
SmsMessage message = new SmsMessage(address, 'Hello flutter world!');
message.onStateChanged.listen((state) {
if (state == SmsMessageState.Sent) {
print("SMS is sent!");
} else if (state == SmsMessageState.Delivered) {
print("SMS is delivered!");
}
});
sender.sendSms(message);
}
Can someone help me how to solve this issue please?
Related
I try to clean up my mobile flutter project: remove Podfile.lock, Podfile, .pub-cache
And then try to run flutter pub get. After than, when run flutter run I get this kind of error below. I still don't know how to fix:
../../../../Software/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.2.48-beta/lib/src/common/pdfviewer_plugin.dar
t:88:40: Error: The getter 'Uint8List' isn't defined for the class 'PdfViewerPlugin'.
- 'PdfViewerPlugin' is from 'package:syncfusion_flutter_pdfviewer/src/common/pdfviewer_plugin.dart'
('../../../../Software/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.2.48-beta/lib/src/common/pdfviewer_plugin.
dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Uint8List'.
_renderedPages![pageIndex] = Uint8List.fromList(image);
^^^^^^^^^
../../../../Software/flutter/.pub-cache/hosted/pub.dartlang.org/fl_chart-0.46.0/lib/src/chart/pie_chart/pie_chart.dart:42:20: Warning:
Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart'
('../../../../Software/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance?.addPostFrameCallback((_) {
^
../../../../Software/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_pdfviewer_platform_interface-20.2.48-beta/lib/src/method_channel_p
dfviewer.dart:12:7: Error: 'Uint8List' isn't a type.
Uint8List documentBytes, String documentID) async {
^^^^^^^^^
../../../../Software/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_pdfviewer_platform_interface-20.2.48-beta/lib/src/method_channel_p
dfviewer.dart:35:34: Error: 'Uint8List' isn't a type.
return _channel.invokeMethod<Uint8List>('getImage', <String, dynamic>{
^^^^^^^^^
Failed to package /Users/hoang/Works/Projects/unikgate/erest/erest_mobile.
Command PhaseScriptExecution failed with a nonzero exit code
Here is my flutter doctor -v
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.1, on macOS 12.1 21C52 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2021.1)
[✓] VS Code (version 1.71.0)
Can some one help me to solve this? Many thanks!
Here's an image version of the console output for the flutter run.
Here's an image version of the console output for flutter doctor -v.
Running flutter run gives me:
'''Downloading ios tools... 7.8s
Downloading ios-profile tools... 5.5s
Downloading ios-release tools... 34.0s
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App
Store.
Running pod install... 9.3s
Running Xcode build...
Xcode build done. 89.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type
'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type
'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type
'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type
'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method
'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
- 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart'
('../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
'''
Running flutter doctor -v gives me:
'''
Downloading android-arm-profile/darwin-x64 tools... 1.1s
Downloading android-arm-release/darwin-x64 tools... 0.9s
Downloading android-arm64-profile/darwin-x64 tools... 1.7s
Downloading android-arm64-release/darwin-x64 tools... 1.0s
Downloading android-x64-profile/darwin-x64 tools... 1.3s
Downloading android-x64-release/darwin-x64 tools... 1.0s
[✓] Flutter (Channel master, 1.20.0-1.0.pre.132, on Mac OS X 10.15.2 19C57, locale en-US)
• Flutter version 1.20.0-1.0.pre.132 at /Users/lesleychang/flutter
• Framework revision 5995661777 (6 hours ago), 2020-06-19 16:15:58 -0700
• Engine revision 676cd566f7
• Dart version 2.9.0 (build 2.9.0-17.0.dev 7e72c9ae7e)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] Connected device (1 available)
• iPhone SE (2nd generation) • 7305F6FC-57BD-4A00-A55D-FC6741E759C4 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
! Doctor found issues in 2 categories.
'''
I can't run my Flutter app on my iOS emulator at all and I've looked at similar posts to no avail. Any pointers on what to do? Or any other communities I can try getting help from? Thanks!
Due to a breaking change made by https://github.com/flutter/flutter/pull/58635, you can upgrade flutter_svg to 0.18.0 or downgrade flutter otherwise.
upgrade your flutter_svg plugin to
flutter_svg: ^0.19.0
I have a flutter built app and would like to add firebase_auth and cloud_firestore. It used to work smoothly. Then I added the following two lines into pubspec.yaml:
firebase_auth: ^0.15.4
cloud_firestore: ^0.13.0+1
and run packages get. Without doing anything else, if I run my project it gives the following error:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 132.2s
Failed to build iOS app
Error output from Xcode build:
↳
2020-01-31 14:17:56.015 xcodebuild[41367:4940394] DTDeviceKit: deviceType from 00008006-0007354C3EFA002E was NULL
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> == Underlying device preparation errors ==
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
Domain: com.apple.platform.iphoneos
Code: 5
Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fbde662bd20:'com.apple.platform.iphoneos':<DVTFilePath:0x7fbde662bca0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
--
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> == END: Underlying device preparation errors ==
** BUILD FAILED **
Xcode's output:
↳
/Users/Baseduo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ios/Classes/FLTFirebaseAuthPlugin.m:505:38: error: no known class method for selector 'credentialWithProviderID:IDToken:rawNonce:accessToken:'
credential = [FIROAuthProvider credentialWithProviderID:provider
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Baseduo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ios/Classes/FLTFirebaseAuthPlugin.m:514:38: error: no known class method for selector 'credentialWithProviderID:IDToken:rawNonce:'
credential = [FIROAuthProvider credentialWithProviderID:provider
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
There is also no response on Flutter Doctor:
/Users/Baseduo/Developer/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.2 19C57, locale en-TR)
• Flutter version 1.12.13+hotfix.7 at /Users/Baseduo/Developer/flutter
• Framework revision 9f5ff2306b (4 days ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/Baseduo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.0.beta.2
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• Baseduo • 4be1310269eaf14dd153c6def229bddceaeebbe6 • ios • iOS 13.3.1
• iPhone 11 Pro Max • 954398E8-1CB7-4189-B2E6-84E9F87BB94A • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
! Doctor found issues in 1 category.
Process finished with exit code 0
I could not find any action to resolve that and appreciate for your answer.
Thank you,
ps: I have used the same action into my other apps and no problem exists.
ps2: It works for Android emulator.
Running pod update in the ios directory fixes the problem (at least until next time). See this bug report.
I added dependencies to my pubspec.yaml file and pubget ran without errors, then I entered flutter run and i got this error, before adding any of the dependencies the application ran fine on the ios emulator:
////////////////////////////////////////////////////
Launching lib/main.dart on iPhone X in debug mode...
Running pod install... 54.9s
Running Xcode build...
Xcode build done. 164.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
asses/CloudFirestorePlugin.m:155:24: error: no visible #interface for 'FIRQuery'
declares the selector 'queryWhereField:arrayContainsAny:'
query = [query queryWhereField:fieldName arrayContainsAny:value];
~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
asses/CloudFirestorePlugin.m:157:24: error: no visible #interface for 'FIRQuery'
declares the selector 'queryWhereFieldPath:arrayContainsAny:'
query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];
~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
asses/CloudFirestorePlugin.m:163:24: error: no visible #interface for 'FIRQuery'
declares the selector 'queryWhereField:in:'
query = [query queryWhereField:fieldName in:value];
~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
asses/CloudFirestorePlugin.m:165:24: error: no visible #interface for 'FIRQuery'
declares the selector 'queryWhereFieldPath:in:'
query = [query queryWhereFieldPath:fieldPath in:value];
~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
asses/CloudFirestorePlugin.m:764:16: warning: 'timestampsInSnapshotsEnabled' is
deprecated [-Wdeprecated-declarations]
settings.timestampsInSnapshotsEnabled =
(bool)call.arguments[#"timestampsInSnapshotsEnabled"];
^
In module 'FirebaseFirestore' imported from
/Users/kev/Documents/flutterprojects/shopapp/ios/Pods/Headers/Public/Firebase/Fireba
se.h:45:
/Users/kev/Documents/flutterprojects/shopapp/ios/Pods/FirebaseFirestore/Firestore/So
urce/Public/FIRFirestoreSettings.h:69:20: note: 'timestampsInSnapshotsEnabled' has
been explicitly marked deprecated here
__attribute__((deprecated));
^
1 warning and 4 errors generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone X.
/////////////////////////////////////////
this is what my pubspec file looks like:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cloud_firestore: ^0.12.11
cupertino_icons: ^0.1.2
firebase_core: ^0.4.2+1
firebase_analytics: ^5.0.6
firebase_auth: ^0.15.1
this is flutter doctor results:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.13.6 17G9016, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 10.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
Github issue link
In the Flutter terminal try this:
cd ios
pod update Firebase/Firestore
For me works perfectly after that.
1- Open xcode for the iOS project by clicking on Runner.xcworkspace file located in ios directory
2- Click Runner (on the left of the xcode)
3- Click on Build Settings tab (in the middle of xcode)
4- Change iOS Deployment Target to 12.1 for example
5- Save your action
6- Run flutter clean then run your app
From flutter terminal, try this:
flutter clean
cd ios
pod update Firebase/Firestore
Now flutter run will work as expected.
I'm using the multicast_dns package for Flutter and get an exception on iOS.
It works as expected on Android. I have tested this with the code example provided with the package, see https://pub.dev/packages/multicast_dns
The error is:
OS Error: Can't assign requested address, errno = 49 in
_NativeSocket.joinMulticast. (socket_patch.dart)
I have tried various multicast addresses, the default 224.0.0.251, 230.180.0.1 and 239.0.180.1.
import 'package:multicast_dns/multicast_dns.dart';
Future<void> main() async {
const String name = '_dartobservatory._tcp.local';
final MDnsClient client = MDnsClient();
await client.start(mDnsAddress: InternetAddress('239.0.180.1'));
await for (PtrResourceRecord ptr in client
.lookup<PtrResourceRecord>(ResourceRecordQuery.serverPointer(name))) {
await for (SrvResourceRecord srv in client.lookup<SrvResourceRecord>(
ResourceRecordQuery.service(ptr.domainName))) {
final String bundleId =
ptr.domainName; //.substring(0, ptr.domainName.indexOf('#'));
print('Dart observatory instance found at '
'${srv.target}:${srv.port} for "$bundleId".');
}
}
client.stop();
print('Done.');
}
Flutter doctor:
mdnstest $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.14.5 18F203, locale
en)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
✗ Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.