Skip to content

Commit

Permalink
MQTT-Client-Framework 0.8.3
Browse files Browse the repository at this point in the history
> Release date 2016-09-23

[FIX] Cannot build after CocoaLumberjack new release #199
[FIX] Xcode8 / Swift3 compatibility
  • Loading branch information
Christoph Krey committed Sep 23, 2016
1 parent e5ee6e3 commit 8732095
Show file tree
Hide file tree
Showing 150 changed files with 1,718 additions and 3,110 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
MQTT-Client-Framework iOS/OSX/tvOS Release Notes
================================================

## MQTT-Client-Framework 0.8.3
> Release date 2016-09-23
[FIX] Cannot build after CocoaLumberjack new release #199
[FIX] Xcode8 / Swift3 compatibility

## MQTT-Client-Framework 0.8.1
> Release date 2016-08-10
Expand Down
14 changes: 9 additions & 5 deletions MQTTClient.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |mqttc|
mqttc.name = "MQTTClient"
mqttc.version = "0.8.2"
mqttc.version = "0.8.3"
mqttc.summary = "iOS, OSX and tvOS native ObjectiveC MQTT Client Framework"
mqttc.homepage = "https://github.com/ckrey/MQTT-Client-Framework"
mqttc.license = { :type => "EPLv1", :file => "LICENSE" }
mqttc.author = { "Christoph Krey" => "[email protected]" }
mqttc.source = {
:git => "https://github.com/ckrey/MQTT-Client-Framework.git",
:tag => "0.8.2",
:tag => "0.8.3",
:submodules => true
}

Expand All @@ -17,15 +17,20 @@ Pod::Spec.new do |mqttc|
mqttc.osx.deployment_target = "10.10"
mqttc.tvos.deployment_target = "9.0"
mqttc.default_subspec = 'Core'
mqttc.compiler_flags = '-DLUMBERJACK'

mqttc.subspec 'Core' do |core|
core.dependency 'MQTTClient/Min'
core.dependency 'MQTTClient/Manager'
end

mqttc.subspec 'Min' do |min|
min.source_files = "MQTTClient/MQTTClient/MQTTCFSocketDecoder.{h,m}",
min.dependency 'MQTTClient/MinNSLog'
min.dependency 'CocoaLumberjack', '~> 2.3.0'
min.compiler_flags = '-DLUMBERJACK'
end

mqttc.subspec 'MinNSLog' do |minnslog|
minnslog.source_files = "MQTTClient/MQTTClient/MQTTCFSocketDecoder.{h,m}",
"MQTTClient/MQTTClient/MQTTCFSocketEncoder.{h,m}",
"MQTTClient/MQTTClient/MQTTCFSocketTransport.{h,m}",
"MQTTClient/MQTTClient/MQTTCoreDataPersistence.{h,m}",
Expand All @@ -43,7 +48,6 @@ Pod::Spec.new do |mqttc|
"MQTTClient/MQTTClient/MQTTSessionLegacy.{h,m}",
"MQTTClient/MQTTClient/MQTTSessionSynchron.{h,m}",
"MQTTClient/MQTTClient/MQTTTransport.{h,m}"
min.dependency 'CocoaLumberjack'
end

mqttc.subspec 'Manager' do |manager|
Expand Down
74 changes: 20 additions & 54 deletions MQTTClient/MQTTClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,8 @@
isa = PBXNativeTarget;
buildConfigurationList = 84A7BDA61D576C740070ADA2 /* Build configuration list for PBXNativeTarget "MQTTClient" */;
buildPhases = (
83FB5C657A16A368D9C116D2 /* [CP] Check Pods Manifest.lock */,
84A7BD891D576C730070ADA2 /* Sources */,
C05723F91167465880FF99CE /* Frameworks */,
3FEA081B5C2525AC32014FE5 /* [CP] Embed Pods Frameworks */,
FFC14E0C7FC40633F7D50AF4 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -946,14 +943,15 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0710;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Christoph Krey";
TargetAttributes = {
8404875D1C51212600569C79 = {
CreatedOnToolsVersion = 7.2;
};
840716311BBEF13A00FBB3CB = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0800;
};
8425D7001BBE8D3D005AD733 = {
CreatedOnToolsVersion = 7.1;
Expand Down Expand Up @@ -1120,22 +1118,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
3FEA081B5C2525AC32014FE5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MQTTClient/Pods-MQTTClient-frameworks.sh\"\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
4FDDA8E069DB09D8AA6752F5 /* [CP] Embed Pods Frameworks */ = {
Expand Down Expand Up @@ -1165,22 +1148,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
83FB5C657A16A368D9C116D2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
84B739B01A66EE0D00B103F4 /* Create Docs */ = {
Expand Down Expand Up @@ -1239,7 +1207,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
FCD05701E6A805296E8D37CD /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -1257,21 +1225,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MQTTClientOSXTests/Pods-MQTTClientOSXTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
FFC14E0C7FC40633F7D50AF4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MQTTClient/Pods-MQTTClient-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -1453,6 +1406,7 @@
SDKROOT = macosx;
SUPPORTED_PLATFORMS = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -1479,6 +1433,7 @@
SDKROOT = macosx;
SUPPORTED_PLATFORMS = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down Expand Up @@ -1541,13 +1496,18 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -1580,12 +1540,17 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -1595,6 +1560,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -1708,7 +1674,7 @@
buildSettings = {
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -1738,7 +1704,7 @@
buildSettings = {
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
64 changes: 35 additions & 29 deletions MQTTClient/MQTTClientTests/SwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class SwiftTests : MQTTTestHelpers {
var sessionError = false;
var sessionReceived = false;
var sessionSubAcked = false;

var broker: NSDictionary = NSDictionary();


override func setUp() {
super.setUp();
}
Expand All @@ -23,34 +25,39 @@ class SwiftTests : MQTTTestHelpers {
}

func testSwiftSubscribe() {
print("testSwiftSubscribe \(brokers)")

for brokerName in brokers.allKeys {
var broker: NSDictionary;
broker = brokers.valueForKey(brokerName as! String) as! NSDictionary;
if (broker.valueForKey("websocket"))?.boolValue != true {
print("testSwiftSubscribe \(brokerName)")

broker = brokers.value(forKey: brokerName as! String) as! NSDictionary;
print("testSwiftSubscribe \(broker)")

if ((broker.value(forKey: "websocket")) as AnyObject).boolValue != true {

session = MQTTSession();
session!.delegate = self;

session!.connectToHost(broker.valueForKey("host") as! String,
port:(broker.valueForKey("port")?.unsignedIntValue)!,
usingSSL: (broker.valueForKey("tls")?.boolValue)!);
session!.connect(toHost: broker.value(forKey: "host") as! String,
port:((broker.value(forKey: "port") as AnyObject).uint32Value)!,
usingSSL: ((broker.value(forKey: "tls") as AnyObject).boolValue)!);
while !sessionConnected && !sessionError {
NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow: 1))
RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))
}

session!.subscribeToTopic("#", atLevel: .AtMostOnce)
session!.subscribe(toTopic: "#", at: .atMostOnce)

while sessionConnected && !sessionError && !sessionSubAcked {
NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow: 1))
RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))
}

session!.publishData("sent from Xcode 6.0 using Swift".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false),
session!.publishData("sent from Xcode 8.0 using Swift".data(using: String.Encoding.utf8, allowLossyConversion: false),
onTopic: TOPIC,
retain: false,
qos: .AtMostOnce)
qos: .atMostOnce)

while sessionConnected && !sessionError && !sessionReceived {
NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow: 1))
RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))
}

session!.close()
Expand All @@ -60,16 +67,15 @@ class SwiftTests : MQTTTestHelpers {

func testSessionManager() {
for brokerName in brokers.allKeys {
var broker: NSDictionary;
broker = brokers.valueForKey(brokerName as! String) as! NSDictionary;
if (broker.valueForKey("websocket"))?.boolValue != true {
broker = brokers.value(forKey: brokerName as! String) as! NSDictionary;
if ((broker.value(forKey: "websocket")) as AnyObject).boolValue != true {

let m = MQTTSessionManager()
m.delegate = self

m.connectTo(broker.valueForKey("host") as! String,
port: (broker.valueForKey("port")?.integerValue)!,
tls: (broker.valueForKey("tls")?.boolValue)!,
m.connect(to: broker.value(forKey: "host") as! String,
port: ((broker.value(forKey: "port") as AnyObject).integerValue)!,
tls: ((broker.value(forKey: "tls") as AnyObject).boolValue)!,
keepalive: 60,
clean: true,
auth: false,
Expand All @@ -78,36 +84,36 @@ class SwiftTests : MQTTTestHelpers {
will: false,
willTopic: nil,
willMsg: nil,
willQos: .AtMostOnce,
willQos: .atMostOnce,
willRetainFlag: false,
withClientId: nil)

while (m.state != .Connected) {
while (m.state != .connected) {
print("waiting for connect %d", m.state);
NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow: 1))
RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))
}

}
}
}
override func handleEvent(session: MQTTSession!, event eventCode: MQTTSessionEvent, error: NSError!) {

override func handleEvent(_ session: MQTTSession!, event eventCode: MQTTSessionEvent, error: Error!) {
switch eventCode {
case .Connected:
case .connected:
sessionConnected = true
case .ConnectionClosed:
case .connectionClosed:
sessionConnected = false
default:
sessionError = true
}
}
override func newMessage(session: MQTTSession!, data: NSData!, onTopic topic: String!, qos: MQTTQosLevel, retained: Bool, mid: UInt32) {

override func newMessage(_ session: MQTTSession!, data: Data!, onTopic topic: String!, qos: MQTTQosLevel, retained: Bool, mid: UInt32) {
print("Received \(data) on:\(topic) q\(qos) r\(retained) m\(mid)")
sessionReceived = true;
}

override func subAckReceived(session: MQTTSession!, msgID: UInt16, grantedQoss qoss: [NSNumber]!) {
override func subAckReceived(_ session: MQTTSession!, msgID: UInt16, grantedQoss qoss: [NSNumber]!) {
sessionSubAcked = true;
}

Expand Down
Loading

0 comments on commit 8732095

Please sign in to comment.