Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no such moudle ’CocoaAsyncSocket #64

Closed
lsxredrain opened this issue Apr 14, 2016 · 16 comments
Closed

no such moudle ’CocoaAsyncSocket #64

lsxredrain opened this issue Apr 14, 2016 · 16 comments

Comments

@lsxredrain
Copy link

follow this step
$ git init
Add CocoaMQTT as a git submodule by running the following command:
$ git submodule add https://github.com/emqtt/CocoaMQTT.git

CocoaPods

Install using CocoaPods by adding this line to your Podfile:

use_frameworks! # Add this if you are targeting iOS 8+ or using Swift
pod 'CocoaMQTT'
Then, run the following command:

$ pod install
Last, creat a CocoaMQTT-Bridging-Header.h file in your project, in which add the following line:

import "CocoaMQTT/CocoaMQTT.h"

xcode 7.2
//
// CocoaMQTT.swift
// CocoaMQTT
//
// Created by Feng Leefeng@eqmtt.io on 14/8/3.
// Copyright (c) 2015 emqtt.io. All rights reserved.
//

import Foundation
import CocoaAsyncSocket --- no such moudle ’CocoaAsyncSocket ‘

import MSWeakTimer

@CrazyWisdom
Copy link
Member

Sorry,the document has not been updated, now you do not need to create CocoaMQTT-Bridging-Header.h

@lsxredrain
Copy link
Author

CocoaPods , Carthage and Manual should done step by step?
I follow CocaPods and Manual, the project will compile failed for "import CocoaAsyncSocket --- no such moudle ’CocoaAsyncSocket ‘

@CrazyWisdom
Copy link
Member

Does not need select all, just select one: CocoaPods Carthage or Manual

@CrazyWisdom
Copy link
Member

@lsxredrain ,you can recreate a project, just use CocoaPods.

@lsxredrain
Copy link
Author

follow those step:
$ git init
$git init$ git submodule add https://github.com/emqtt/CocoaMQTT.git
$cd CocacaMQTT
$vi Podfile
$cat Podfileplatform :ios, 9.0
use_frameworks!

pod 'CocoaAsyncSocket'
pod 'MSWeakTimer'
pod 'CocoaMQTT'
$pod install
open CocoaMQTT.xcodeproj
then compile this project in Xcode, it will find three compile error/Users/lsx/workbase/CocoaMQTT/Source/CocoaMQTT.swift:364:27: Expected expression in list
of expressions
/Users/lsx/workbase/CocoaMQTT/Source/CocoaMQTT.swift:364:27: Expected ',' separator/Users/lsx/workbase/CocoaMQTT/Source/CocoaMQTT.swift:10:8: No such module 'CocoaAsyncSocket'

@CrazyWisdom
Copy link
Member

CrazyWisdom commented Apr 18, 2016

just two step:

1.create the Podfile with follow content:

use_frameworks!

pod 'CocoaMQTT' 

2.excude the command:
pod install

@lsxredrain
Copy link
Author

lsxredrain commented Apr 18, 2016

lsxdeMacBook-Pro:CocaMQTT lsx$ cat Podfile
use_frameworks!
pod 'CocoaMQTT'
lsxdeMacBook-Pro:CocaMQTT lsx$ pod install
CocoaPods 1.0.0.beta.8 is available.
To update use: gem install cocoapods --pre
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies
[!] Could not automatically select an Xcode project. Specify one in your Podfile like so:

xcodeproj 'path/to/Project.xcodeproj'

lsxdeMacBook-Pro:CocaMQTT lsx$ ls
Podfile Pods

@CrazyWisdom
Copy link
Member

CrazyWisdom commented Apr 18, 2016

http://stackoverflow.com/questions/21070977/how-do-i-select-a-project-in-my-podfile-im-getting-the-error-unable-to-find-t

Make sure you are running $pod install from your project directory:

@lsxredrain
Copy link
Author

lsxredrain commented Apr 19, 2016

lsxdeMacBook-Pro:CocaMQTT lsx$ pwd
/Users/lsx/workbase/CocaMQTT
lsxdeMacBook-Pro:CocaMQTT lsx$ ls
Podfile
lsxdeMacBook-Pro:CocaMQTT lsx$ cat Podfile
platform :ios, 9.0
use_frameworks!
pod 'CocoaMQTT'lsxdeMacBook-Pro:CocaMQTT lsx$ pod install
Updating local specs repositories

CocoaPods 1.0.0.beta.8 is available.
To update use: gem install cocoapods --pre
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies
[!] Could not automatically select an Xcode project. Specify one in your Podfile like so:

xcodeproj 'path/to/Project.xcodeproj'

@CrazyWisdom CrazyWisdom reopened this Apr 20, 2016
@CrazyWisdom
Copy link
Member

  1. first, you should create an xcode project
  2. create a Podfile in the project folder
  3. excute command pod install

like my test project:

➜  swifttest ls
Podfile               Pods                  swifttest.xcodeproj
Podfile.lock          swifttest             swifttest.xcworkspace
➜  swifttest 

@lsxredrain
Copy link
Author

lsxredrain commented Apr 20, 2016

1 create null project as named CocoaHello in Xcode 7.2
2 create Podfile
3 pod install

localhost:CocoaHello lsx$ ls
CocoaHello Podfile uncrustify.cfg
CocoaHello.xcodeproj Podfile.lock
CocoaHello.xcworkspace Pods
localhost:CocoaHello lsx$ cat Podfile
platform :ios, '9.0'
use_frameworks! # Add this if you are targeting iOS 8+ or using Swift
pod 'CocoaMQTT'localhost:CocoaHello lsx$ ls Pods/
CocoaAsyncSocket Local Podspecs Pods.xcodeproj
CocoaMQTT MSWeakTimer Target Support Files
Headers Manifest.lock

4 close CocoaHello.xcodeproj
5 open CocoaHello.xcworkspace ------ not CocoaHello.xcodeproj
still have error
/Users/lsx/github/podtest/Pods/CocoaMQTT/Source/CocoaMQTT.swift:364:27: Expected expression in list of expressions
/Users/lsx/github/podtest/Pods/CocoaMQTT/Source/CocoaMQTT.swift:364:27: Expected ',' separator
/Users/lsx/github/podtest/Pods/CocoaMQTT/Source/CocoaMQTT.swift:361:68: Missing argument for parameter 'selector' in call

@lsxredrain
Copy link
Author

//CocoaMQTTReader Delegate

public func didReceiveConnAck(reader: CocoaMQTTReader, connack: UInt8) {
    connState = CocoaMQTTConnState.CONNECTED
    #if DEBUG
    NSLog("CocoaMQTT: CONNACK Received: \(connack)")
    #endif

    let ack = CocoaMQTTConnAck(rawValue: connack)!
    delegate?.mqtt(self, didConnectAck: ack)

    //keep alive
   //begin commit by lsxredrain 2016-4-21,then will compile sucessed
    if ack == CocoaMQTTConnAck.ACCEPT && keepAlive > 0 {
    //    aliveTimer = MSWeakTimer.scheduledTimerWithTimeInterval(ß
     //       NSTimeInterval(keepAlive),
      //      target: self,
       //     selector: #selector(CocoaMQTT._aliveTimerFired),
        //    userInfo: nil,
         //   repeats: true,
           // dispatchQueue: dispatch_get_main_queue())
    }
    //end 
}

@CrazyWisdom
Copy link
Member

use the xcode7.3

@lsxredrain
Copy link
Author

i can't use Xcode 7.3 for my os is 10.10, can u add selector: #selector(CocoaMQTT._aliveTimerFired) for Xcode 7.2?

@CrazyWisdom
Copy link
Member

you can change selector: #selector(CocoaMQTT._aliveTimerFired)
to selector: "_aliveTimerFired",

@lsxredrain
Copy link
Author

ok thanks a lot!
as a newcomer of swift, I should study this article first
http://blog.csdn.net/eqera/article/details/39312125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants