infitio / flutter_socket_io

Socket IO supprt for flutter. Looking for contributors Swift and Java.
Other
191 stars 113 forks source link

Build Error : error: type of expression is ambiguous without more context when building iOS #153

Closed RageshAntony closed 3 years ago

RageshAntony commented 3 years ago

Describe the bug when building I am getting following error

                                    _
   adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:80:32: error: extraneous argument label 'with:' in call
                        socket.emit(eventName, with: data)
                                   ^           ~~~~~~

   project_name/adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:82:63: error: type of expression is ambiguous without more context
                        socket.emitWithAck(eventName, with: data).timingOut(after: 0) { data in

Have you tried reproducing the issue with example available in this repo? No?

To Reproduce Steps to reproduce the behavior: Just build with new version of flutter

Expected behavior A clear and concise description of what you expected to happen.

Device details:

Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision 9b2d32b605 (12 days ago) • 2021-01-22 14:36:39 -0800 Engine • revision 2f0af37152 Tools • Dart 2.10.5

Relevant Logs

Add any relevant logs about the problem here.
codydev-git commented 3 years ago

I got the same error. Did you fix?

codydev-git commented 3 years ago

![Uploading image.png…]()

RageshAntony commented 3 years ago

No .

But The repo owner promised that they will fix it by next week

On Tue, 16 Feb, 2021, 11:29 PM Super Coder, notifications@github.com wrote:

I got the same error. Did you fix?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/infitio/flutter_socket_io/issues/153#issuecomment-780014989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITNQ53DVE44EFAJN3DOU5DS7KW7FANCNFSM4XCGB2XQ .

codydev-git commented 3 years ago

this package was working yesterday. But after I have reinstalled the pod for a new package, I can not build iOS. what is the problem?

changyeun commented 3 years ago

i got the same error. fix please

tiholic commented 3 years ago

It is taking time for me to find the root cause of issue. Currently targeting to have the open PR #128 landed in next week.

RageshAntony commented 3 years ago

Thanks. We expecting your fixes.

Thanks for starting to fix the issue

On Tue, 2 Mar, 2021, 11:46 AM Rohit Reddy Abbadi, notifications@github.com wrote:

It is taking time for me to find the root cause of issue. Currently targeting to have the open PR related to redesign landed in next week.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/infitio/flutter_socket_io/issues/153#issuecomment-788645555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITNQ52EKFCKREVNPEY3SI3TBR7CRANCNFSM4XCGB2XQ .

2peter3 commented 3 years ago

a fix for this would be awesome

XCode: Version 12.4 (12D4e) flutter: 1.22.6

2peter3 commented 3 years ago

does anybody know a workaround to fix this?

shashoug commented 3 years ago

i have the same issue now, any updates?

smasinde commented 3 years ago

support needed

roskimlong commented 3 years ago

I met that error too

shashoug commented 3 years ago

@smasinde @roskimlong I have switched to another package and worked like charm. If you want guys i can provide you with the code and the steps. Happy coding.

roskimlong commented 3 years ago

@Shashoug I will switch too if there is nothing update about this issue for ios, but android is working well !!!

shashoug commented 3 years ago

@roskimlong I think you should switch. I switched because i had to move my app into production. I won't risk any issues because my app depends on Socket.IO

roskimlong commented 3 years ago

@Shashoug okay, I also think about that too. Can you guys me some information or more samples of another Socket?

shashoug commented 3 years ago

@roskimlong Sure! Just give me a couple of minutes to get things more clear.

roskimlong commented 3 years ago

@Shashoug thanks beforehand brother!

roskimlong commented 3 years ago

@tiholic any update brother we are waiting your new update ❤️

tiholic commented 3 years ago

Looking at a few failing tests at the moment. Will share an update soon

roskimlong commented 3 years ago

Yeah brother, I'm your big fan ❤️

carman247 commented 3 years ago

I'm getting the same error I think .. no idea what's going on 😢

roskimlong commented 3 years ago

This problem is not yet fixed out!

carman247 commented 3 years ago

Just posting this here in case it helps ..

Error

    /Users/XXXX/XXXX/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:754:32: warning: immutable value 'reason' was never used; consider replacing with '_' or removing it
            case let .disconnected(reason, code):
                                   ^~~~~~
                                   _
    /Users/XXXX/XXXX/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:754:40: warning: immutable value 'code' was never used; consider replacing with '_' or removing it
            case let .disconnected(reason, code):
                                           ^~~~
                                           _
    /Users/XXXX/XXXX/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:80:54: error: missing argument for parameter 'completion' in call
                        socket.emit(eventName, with: data)
                                                         ^
                                                         , completion: <#(() -> ())?#>
    /Users/XXXX/XXXX/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:226:15: note: 'emit(_:with:completion:)' declared here
        open func emit(_ event: String, with items: [SocketData], completion: (() -> ())?) {
                  ^
    /Users/XXXX/XXXX/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:80:50: error: cannot convert value of type '[Any]' to expected argument type '[SocketData]'
                        socket.emit(eventName, with: data)
                                                     ^
    /Users/XXXX/XXXX/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:80:50: note: arguments to generic parameter 'Element' ('Any' and 'SocketData') are expected to be equal
                        socket.emit(eventName, with: data)
                                                     ^
    /Users/XXXX/XXXX/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adhara_socket_io-0.4.2+1/ios/Classes/AdharaSocket.swift:82:63: error: type of expression is ambiguous without more context
                        socket.emitWithAck(eventName, with: data).timingOut(after: 0) { data in
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Flutter doctor -v

[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.1 20D75 darwin-x64, locale en-GB)
    • Flutter version 2.0.3 at /Users/XXXX/XXXX/Developer/flutter
    • Framework revision 4d7946a68d (12 days ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/XXXX/XXXX/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • iPhone (mobile) • 1d1eb83ee2a8e15f8785d98f988973abd4e58f6a • ios            • iOS 14.4
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 89.0.4389.90

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
carman247 commented 3 years ago

I've manage to build and run the example app on my iphone ... really confused now

carman247 commented 3 years ago

I noticed that 2 pods in my project had been updated from:

# Podfile.lock
- Socket.IO-Client-Swift (15.2.0)
   - Starscream (~> 3.1)
- Starscream (3.1.1)

to:

# Podfile.lock
- Socket.IO-Client-Swift (16.0.1)
   - Starscream (~> 4.0)
- Starscream (4.0.4)

reverting back to the previous versions allowed me to build on iOS

IzGabs commented 3 years ago

@carman247 THANK YOU SO MUCH!!! This really helps, hope they fix this issue asap

@roskimlong Hey bud, did you see @carman247 answer already? It can work for you too

roskimlong commented 3 years ago

@carman247 Thanks so much!! It's worked, but I need to downgrade Flutter version from 2.0 @IzGabs Thanks brother

RageshAntony commented 3 years ago

I think this repo is inactive and deprecated

It's time to build a alternate one

On Thu, 1 Apr, 2021, 11:04 PM Ros KimLong, @.***> wrote:

@carman247 https://github.com/carman247 Thanks so much!! It's worked, but I need to downgrade Flutter version from 2.0 @IzGabs https://github.com/IzGabs Thanks brother

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/infitio/flutter_socket_io/issues/153#issuecomment-812061632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITNQ542M6M6PLEU3YUW3MLTGSVCVANCNFSM4XCGB2XQ .

tiholic commented 3 years ago

@RageshAntony @roskimlong @IzGabs @carman247 @Shashoug @smasinde @liqiang1995 @changyeun @2peter3

Released a new stable version (1.0.0) to pub.

Improvised maintenance of the project by adding integration tests along.

Please try and let know if this issue is resolved.

FYI: Socket v3/v4 support needs to be added yet

RageshAntony commented 3 years ago

Thanks very much

Please Let me check

Thanks for your dedication for fixing and starting maintenance again 🙏🙏🙏❤️

On Tue, 6 Apr, 2021, 4:09 PM Rohit Reddy Abbadi, @.***> wrote:

@RageshAntony https://github.com/RageshAntony @roskimlong https://github.com/roskimlong @IzGabs https://github.com/IzGabs @carman247 https://github.com/carman247 @Shashoug https://github.com/Shashoug @smasinde https://github.com/smasinde @liqiang1995 https://github.com/liqiang1995 @changyeun https://github.com/changyeun @2peter3 https://github.com/2peter3

Released a new stable version (1.0.0) to pub.

Improvised maintenance of the project by adding integration tests along.

Please try and let know if this issue is resolved.

FYI: Socket v3/v4 support needs to be added yet

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/infitio/flutter_socket_io/issues/153#issuecomment-814017245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITNQ54LZJ5RTCPMZFYLSF3THLQHNANCNFSM4XCGB2XQ .

roskimlong commented 3 years ago

@tiholic I tried to add version 1.0.0 but the error still the same

.pub-cache/hosted/pub.dartlang.org/adhara_socket_io-1.0.0/ios/Classes/AdharaSocket.swift:69:53: note: arguments to generic parameter 'Element' ('Any' and 'SocketData') are expected to be equal socket.emitWithAck(eventName, with: data).timingOut(after: 0) { data in

tiholic commented 3 years ago

@roskimlong This log seems to be note only, while the actual error might be different.

For example, error log looks like this (notice the log level is printed as :error: in the log below - I wantedly injected an error here for demonstration. The log level you shared is :note: only)

image

Please share full logs if XCode build was failing.

Also share:

  1. iOS version
  2. XCode version
  3. Simulator/device
  4. Podfile
roskimlong commented 3 years ago

The problem is still the same to the topic of issue 😌😌😌

tiholic commented 3 years ago

@roskimlong

This comment answers your issue https://github.com/infitio/flutter_socket_io/issues/153#issuecomment-811039639

You can see the new integration tests use the same dependencies and the last test was run on latest stable channel (2.0.3): https://github.com/infitio/flutter_socket_io/blob/master/test_integration/ios/Podfile.lock#L7

Otherwise, it would help if you can share your Podfile.lock

Here are few other steps you could try, if you haven't already:

  1. flutter clean
  2. delete ios/Podfile.lock
  3. delete ios/Pods
  4. rebuild the project
roskimlong commented 3 years ago

Yes it's worked when I change in pod lock, version of socket and Starscream

tiholic commented 3 years ago

Closing this issue as addressed. Feel free to re-open if required.