Socket.io-client-swift: Could not build module 'SocketIO'

Created on 22 Jun 2017  ·  48Comments  ·  Source: socketio/socket.io-client-swift

What i did

  • Remove all pod files and reinstall
  • Added pod 'Socket.IO-Client-Swift', '~> 10.0.1’
  • Removed derived data
  • Clean the project
    screen shot 2017-06-22 at 12 29 12 pm

screen shot 2017-06-22 at 12 25 47 pm

I got these Error
Xcode 8.3.3
COCOAPODS UPDATED TO LATEST VIRSION

bug unconfirmed

All 48 comments

Hello anyone here to solve this my problem

+1

can anyone help me out this problem

@jose920405 have you resolve this issue ?

No 😢

Hm, this looks like a bridging error, since it's an error in the bridging header.

For some reason this guy https://github.com/socketio/socket.io-client-swift/blob/master/Source/SocketEngineSpec.swift#L47 isn't being bridged correctly. Does this still happen in the latest version?

yes still could not build module error are there in latest version

still not resolve this issue in pod 'Socket.IO-Client-Swift', '~> 11.1.2'

Yeah, I haven't looked into this issue yet. Not sure what it could be since the Objective-C tests themselves pass, and it looks like an issue with the bridging that's happening.

what should i change or what should i do with bridging Please help me out..... Thank you....

Are you defining a swift version somewhere?

This my pod dependency

Podfile.txt

project is in objc

When i downgrade to Socket.IO-Client-Swift 8.3.3
screen shot 2017-09-02 at 12 01 21 pm

@chirag225 I'm not able to reproduce. I just tested with 11.1.2 and CocoaPods and I was able to use SocketIO in Objective-C fine. I'm not sure why your thing is bridging like that. I used Xcode 8.3.3.

project 'SocketIOSwiftiOS.xcodeproj'

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'SocketIOSwiftiOS' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'Socket.IO-Client-Swift', '~> 11.1.2' # Or latest version

  target 'SocketIOSwiftiOSUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Hello i did some modification in code

i used
#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong, nullable) dispatch_queue_t handleQueue;

else

@property (nonatomic, assign, nullable) dispatch_queue_t handleQueue;

endif

instead of
@property (nonatomic, strong) dispatch_queue_t _Nonnull handleQueue;

now no more error comes

I am new to IOS developer and pod concept. I am using Mac O.S 10.12.6 , xcode - 8.3.3 and swift4
when i am trying establish socket io connection it is throws error like "No such module 'SocketIO'"
please help me to short out the issue

screen shot 2017-09-04 at 6 33 35 pm

If I add Source file directory I am getting "No such module 'StarscreamSocketIO'"
below I am providing Screen shot also
screen shot 2017-09-04 at 7 11 46 pm

@chirag225 That might fix your issue. But it doesn't explain why you needed to do that yourself. It should be the Swift compiler's job to make a bridging header. Maybe there's some other settings that have been changed?

Yes thats i am searching for, i think somewhere in Xcode setting need to change, can you share some point which should i check for swift compiler Thank you....

hi @chirag225 .

you definitely had to go down to 8.3.3?

you could not run the last 11.1.2, as did @nuclearace ?

I went back to doing all the steps from 0 again and I still have the error in import.

captura de pantalla 2017-09-05 a la s 11 52 39 a m

Hi @nuclearace ,

Mi xcode is 8.3.2 and I keep replicating the problem, doing everything from the beginning of time, from pod init.

Can you give us a step by step of how you do it? and help us updating the readme, because surely the steps that are there do not work for objective-c

@jose920405 Does this project only have socket.io has a dependency? If not, have you tried just having socket.io in the project?

I guess another thing to note is that my initial project was created as a Swift project, which then added Objective-C files.

Let me try from an objc project.

@nuclearace thank you very very much.

My project had no pods, I'm just starting pods just for this library.

target 'myProj QA' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for myProj QA
  pod 'Socket.IO-Client-Swift', '~> 11.1.2'

end

I am working on a project that has not been updated for more than 1 year and is written completely in objective c, the only files that had in swift, are those of this module. This project is only running in xcode 7.3 and what I try to do is run it in xcode 8.

I'm not sure which version of the library is being used, except that the library has been imported manually. When I try to run xcode 8, the only thing that failed was everything related to socketio, because syntax converted from xcode not works correctly.

@jose920405 @chirag225

  1. New blank Objective-C based iOS project with Xcode 8.3.3
  2. Create Podfile
project 'SocketIOObjc.xcodeproj'

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'SocketIOObjc' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'Socket.IO-Client-Swift', '~> 11.1.2' # Or latest version

end
  1. pod repo update && pod install
  2. Use the new .xcworkspace created
  3. Add @import SocketIO;
  4. Compile

I get no errors doing this.

Oh this project started in Xcode 7? Maybe it has something to do with that. Is something defining a SWIFT_VERSION in the build settings?

captura de pantalla 2017-09-05 a la s 12 26 31 p m

The latest version is built using swift 3.1

Not sure if that'll fix anything though.

😮 Let me try. Thank you

Apparently not the cause, the problem persists

What are your target versions? I haven't tested anything lower than iOS 10 in awhile.

IOS 10 too.

When run xcode 8 ==> ios 10
When run xcode 7.3 ==> ios 9

I think maybe the problem is that this module does not work except for xcode 8.3.3 and later, because in mine that is 8.3.2 it is impossible to make it work.

I removed all the implementation that I had made to support this library and tried to run the project again and all the files in the library had syntax errors. It makes me think that this xcode does not have the syntax or the correct version of swift from where the changes were made.

I even went down to the version that said @chirag225 that worked for him and I had the same problem.

Allow me to update my xcode to 8.3.3 and confirm if this solves the problem.

@jose920405 have you find any solution ? i checked all build setting but no luck :(

hi @chirag225.

I have not worked on this at the moment. My boss gave me one priority thing to do and I have postponed this test I was going to do with xcode 8.3.3

@nuclearace can you Suggest me what should i check from Xcode setting or pod setting because it was working in older version Thank you...

Hello, https://github.com/TransitApp/SVHTTPRequest/pull/52
can you look into this, They solved same problem

That's an objective-c based project and I don't have control over the bridging header.

I test in Xcode 9 GM seed but no luck :(

Anything more on this?

No 👍 Thank you for Everything

Socket lib was conflict with other deprecated lib thats why module Error Occurs Now its Working

Thank you Again

Could you tell me how to import socket.io-client-swift to a Objective C project. I installed it from cocoapods but then xcode can not complie success. I used xcode 9.4

@MD04-TanTan what error r you suffering ?

Thanks @chirag225 . I have fix it done

Thanks @chirag225 . I have fix it done

Can you tell how did you fixed this issue ?

I need fix as well

I had same problem with version 15.0.0 >> Could not build module 'SocketIO'
were because have a class name Socketio.swift , caused conflict
Solved by change name of it other name , Socketioclass.swift

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dohab picture Dohab  ·  4Comments

huangxiaolin0425 picture huangxiaolin0425  ·  6Comments

Yelles picture Yelles  ·  5Comments

janiduw picture janiduw  ·  5Comments

alionthego picture alionthego  ·  4Comments