OpenFlutter / flutter_share_me

Flutter Plugin for sharing contents to social media. You can use it share to Facebook , WhatsApp , Twitter And System Share UI. Support Url and Text.
https://github.com/lizhuoyuan
Apache License 2.0
150 stars 145 forks source link

iOS build failed #81

Open alexaung opened 2 years ago

alexaung commented 2 years ago

I got following error when I run on ios device.

flutter doctor

`[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale en-GB) • Flutter version 2.8.1 at /Users/aungmyooo/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 77d935af4d (8 weeks ago), 2021-12-16 08:37:33 -0800 • Engine revision 890a5fca2e • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/aungmyooo/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.64.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.34.0

[✓] Connected device (2 available) • Aung Myo’s iPhone (mobile) • 06e02964e429eeebf29550b03ef955abe09891ef • ios • iOS 15.2.1 19C63 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80

• No issues found!`

`Launching lib/main.dart on Aung Myo’s iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: 4URC862W29 Xcode build done. 98.9s Failed to build iOS app Error output from Xcode build: ↳ BUILD FAILED Xcode's output: ↳

            ^
/Users/aungmyooo/Development/flutter/.pub-cache/git/flutter_share_me-35368f25fd5ff913ca3c5ad32210b1b1335672d4/ios/Classes/SwiftFlutterShareMePlugin.swift:102:38: warning: 'openURL' was deprecated in iOS 10.0
                UIApplication.shared.openURL(whatsAppURL! as URL)
                                     ^
/Users/aungmyooo/Development/flutter/.pub-cache/git/flutter_share_me-35368f25fd5ff913ca3c5ad32210b1b1335672d4/ios/Classes/SwiftFlutterShareMePlugin.swift:161:34: warning: 'openURL' was deprecated in iOS 10.0
            UIApplication.shared.openURL(whatsAppURL! as URL)
                                 ^
/Users/aungmyooo/Development/flutter/.pub-cache/git/flutter_share_me-35368f25fd5ff913ca3c5ad32210b1b1335672d4/ios/Classes/SwiftFlutterShareMePlugin.swift:177:34: warning: 'openURL' was deprecated in iOS 10.0
            UIApplication.shared.openURL(whatsAppURL! as URL)
                                 ^
/Users/aungmyooo/Development/flutter/.pub-cache/git/flutter_share_me-35368f25fd5ff913ca3c5ad32210b1b1335672d4/ios/Classes/SwiftFlutterShareMePlugin.swift:220:38: warning: 'openURL' was deprecated in iOS 10.0
                UIApplication.shared.openURL(urlschme!)
                                     ^
/Users/aungmyooo/Development/flutter/.pub-cache/git/flutter_share_me-35368f25fd5ff913ca3c5ad32210b1b1335672d4/ios/Classes/SwiftFlutterShareMePlugin.swift:240:34: warning: 'openURL' was deprecated in iOS 10.0
            UIApplication.shared.openURL(telegramURL! as URL)
                                 ^

Failed to package /Users/aungmyooo/Development/thitsarparami/thitsarparami.mobile.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order

Could not build the precompiled application for the device.

Error launching application on Aung Myo’s iPhone. Exited (sigterm) `

alexaung commented 2 years ago

I used master. Build error is gone but facebook app is not open. I saw the change in sharefacebook function flutter_share_me: git: url: https://github.com/OpenFlutter/flutter_share_me

`func sharefacebook(message:Dictionary<String,Any>, result: @escaping FlutterResult)  {
    let viewController = UIApplication.shared.delegate?.window??.rootViewController
    //let shareDialog = ShareDialog()
    let shareContent = ShareLinkContent()
    shareContent.contentURL = URL.init(string: message["url"] as! String)!
    shareContent.quote = message["msg"] as? String

    let shareDialog = ShareDialog(viewController: viewController, content: shareContent, delegate: self)
    shareDialog.mode = .automatic
    shareDialog.show()
    result("Sucess")

}`

Share: Fail 2022-02-13 23:00:24.920511+0630 Runner[35151:2168381] flutter: Sucess

definitelyme commented 2 years ago

Hi @alexaung did you find any solution to this?

alexaung commented 2 years ago

@definitelyme I have no luck. So I just use share_plus plugin.