ibm-bluemix-mobile-services/bms-clientsdk-swift-push

Cant build with Xcode 9.3

Closed this issue · 5 comments

  • Using BMSAnalytics (2.2.4)
  • Using BMSAnalyticsAPI (2.2.3)
  • Using BMSCore (2.3.5)
  • Using BMSPush (3.3.2)

Error:

../WeatherGods/Pods/BMSPush/Source/BMSPushUtils.swift:117:24: Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?

The following lines all have the same error:

temp = temp.replacingOccurrences(of: "{{", with: "", options: NSString.CompareOptions.literal, range: nil)
                temp = temp.replacingOccurrences(of: "}}", with: "", options: NSString.CompareOptions.literal, range: nil)
                temp = temp.replacingOccurrences(of: " ", with: "", options: NSString.CompareOptions.literal, range: nil)
                
                if let templateValue = optionVariables[temp] {
                    text = text.replacingOccurrences(of: val , with: templateValue)
                }

I've patched it for now locally:

for val in resultMap {
                if let val = val {
                    var temp = val
                    temp = temp.replacingOccurrences(of: "{{", with: "", options: NSString.CompareOptions.literal, range: nil)
                    temp = temp.replacingOccurrences(of: "}}", with: "", options: NSString.CompareOptions.literal, range: nil)
                    temp = temp.replacingOccurrences(of: " ", with: "", options: NSString.CompareOptions.literal, range: nil)
                    
                    if let templateValue = optionVariables[temp] {
                        text = text.replacingOccurrences(of: val , with: templateValue)
                    }
                }
            }

@meyumeapps Hi, Sure I will make the changes and release new SDK soon.

@meyumeapps I have tried with Xcode 9.3, we are not hitting this issue ..

@meyumeapps Change the Swift Language Version to swift 4.1 in the project. You will be able to get rid-off this error .

rnng commented

Error also in Xcode 9.4; Using swift language version 4.1 and copying above code helped. Thanks.