Skip to content

Commit 4dfd1fd

Browse files
authored
Merge pull request #2 from devmkdd/feat/deploymentTarget_to_v11
Feat/deployment target to v11
2 parents 868ccc3 + e093d13 commit 4dfd1fd

6 files changed

Lines changed: 122 additions & 21 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1230"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "TinyUpnp"
18+
BuildableName = "TinyUpnp"
19+
BlueprintName = "TinyUpnp"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "TinyUpnpTests"
32+
BuildableName = "TinyUpnpTests"
33+
BlueprintName = "TinyUpnpTests"
34+
ReferencedContainer = "container:">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
buildConfiguration = "Debug"
41+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "TinyUpnpTests"
50+
BuildableName = "TinyUpnpTests"
51+
BlueprintName = "TinyUpnpTests"
52+
ReferencedContainer = "container:">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
</TestAction>
57+
<LaunchAction
58+
buildConfiguration = "Debug"
59+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
60+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
61+
launchStyle = "0"
62+
useCustomWorkingDirectory = "NO"
63+
ignoresPersistentStateOnLaunch = "NO"
64+
debugDocumentVersioning = "YES"
65+
debugServiceExtension = "internal"
66+
allowLocationSimulation = "YES">
67+
</LaunchAction>
68+
<ProfileAction
69+
buildConfiguration = "Release"
70+
shouldUseLaunchSchemeArgsEnv = "YES"
71+
savedToolIdentifier = ""
72+
useCustomWorkingDirectory = "NO"
73+
debugDocumentVersioning = "YES">
74+
<MacroExpansion>
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "TinyUpnp"
78+
BuildableName = "TinyUpnp"
79+
BlueprintName = "TinyUpnp"
80+
ReferencedContainer = "container:">
81+
</BuildableReference>
82+
</MacroExpansion>
83+
</ProfileAction>
84+
<AnalyzeAction
85+
buildConfiguration = "Debug">
86+
</AnalyzeAction>
87+
<ArchiveAction
88+
buildConfiguration = "Release"
89+
revealArchiveInOrganizer = "YES">
90+
</ArchiveAction>
91+
</Scheme>

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import PackageDescription
66
let package = Package(
77
name: "TinyUpnp",
88
platforms: [
9-
SupportedPlatform.iOS(.v12),
10-
SupportedPlatform.macOS(.v10_14)
9+
SupportedPlatform.iOS(.v11),
10+
SupportedPlatform.macOS(.v10_14)
1111
],
1212
products: [
1313
// Products define the executables and libraries a package produces, and make them visible to other packages.

Sources/TinyUpnp/Parser/UPNPBrowseResponseDIDLLiteParser.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ extension UPNPBrowseResponseDIDLLiteParser: XMLParserDelegate {
107107

108108

109109
func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
110-
111-
os_log(.info, "didEndElement %s", elementName)
112-
110+
113111

114112
switch elementName {
115113

@@ -120,9 +118,12 @@ extension UPNPBrowseResponseDIDLLiteParser: XMLParserDelegate {
120118
return
121119
}
122120

123-
os_log(.debug, "container: %s", container.description)
124-
parsedItems.append(container)
125121

122+
if #available(iOS 12.0, *) {
123+
os_log(.debug, "container: %s", container.description)
124+
}
125+
126+
parsedItems.append(container)
126127
dictCurrentContainer.removeAll()
127128
resources.removeAll()
128129

@@ -132,7 +133,10 @@ extension UPNPBrowseResponseDIDLLiteParser: XMLParserDelegate {
132133
return
133134
}
134135

135-
os_log(.debug, "item: %s", item.description)
136+
if #available(iOS 12.0, *) {
137+
os_log(.debug, "item: %s", item.description)
138+
}
139+
136140
parsedItems.append(item)
137141
resources.removeAll()
138142

Sources/TinyUpnp/Parser/UPNPBrowseResponseOuterStructureParser.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ extension UPNPBrowseResponseOuterStructureParser: XMLParserDelegate {
7070

7171
public func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
7272

73-
os_log(.info, "didEndElement %s", elementName)
74-
7573
if elementName == "Result" {
76-
os_log(.info, "result: %@", self.currentString)
74+
if #available(iOS 12.0, *) {
75+
os_log(.info, "result: %@", self.currentString)
76+
}
7777
resultString = currentString
7878
return
7979
}
@@ -96,7 +96,6 @@ extension UPNPBrowseResponseOuterStructureParser: XMLParserDelegate {
9696

9797

9898
public func parserDidEndDocument(_ parser: XMLParser) {
99-
os_log(.info, "parserDidEndDocument ")
10099

101100
result = CDSBrowseResponseBaseResult(numberReturned: numberReturned,
102101
totalMatches: totalMatches,

Sources/TinyUpnp/Parser/UPNPBrowseResponseParser.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ public class UPNPBrowseResponseParser {
1919
fileprivate var baseParser: UPNPBrowseResponseOuterStructureParser?
2020
fileprivate var didlLiteParser: UPNPBrowseResponseDIDLLiteParser?
2121

22-
22+
2323
public func parse(data: Data, then handler: @escaping CompletionHandler) {
2424
completionHandler = handler
2525

26-
if let stringData = String(data: data, encoding: .utf8) {
26+
if #available(iOS 12.0, *),
27+
let stringData = String(data: data, encoding: .utf8) {
2728
os_log(.debug, "passed data %s", stringData )
2829
}
29-
30+
3031
parseBaseData(data)
3132
}
3233
}
@@ -35,15 +36,15 @@ public class UPNPBrowseResponseParser {
3536
// MARK: - Private method
3637
fileprivate extension UPNPBrowseResponseParser {
3738

38-
39+
3940
func parseBaseData(_ data: Data) {
4041

4142
baseParser = UPNPBrowseResponseOuterStructureParser()
4243
baseParser?.parse(data: data) { [weak self] result in
4344

4445
switch result {
4546
case .success(let baseResponseData):
46-
47+
4748
guard let resultString = baseResponseData.resultString,
4849
let innerDIDLData = baseResponseData.resultString?.data(using: .utf8) else {
4950
return
@@ -66,13 +67,17 @@ fileprivate extension UPNPBrowseResponseParser {
6667

6768
case .failure(let error):
6869
completionHandler(.failure(error))
69-
70+
7071
}
7172
})
7273

7374
case .failure(let error):
74-
os_log(.error, "error %@", error.localizedDescription)
75-
75+
if #available(iOS 12.0, *) {
76+
os_log(.error, "error %@", error.localizedDescription)
77+
} else {
78+
// Fallback on earlier versions
79+
}
80+
7681
}
7782
}
7883
}

Sources/TinyUpnp/Parser/UPNPMediaServerParser.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ extension UPNPMediaServerParser: XMLParserDelegate {
8282

8383
case "device":
8484
device = deviceFromDict(deviceDict: dictDevice, services: services)
85-
os_log(.debug, "device: %@", self.device.debugDescription)
85+
if #available(iOS 12.0, *) {
86+
os_log(.debug, "device: %@", self.device.debugDescription)
87+
}
8688
case "service":
8789
guard let service = serviceFromDict(serviceDict: dictService) else {
8890
return

0 commit comments

Comments
 (0)