logo
down
shadow

CFOptionFlags in Swift 4


CFOptionFlags in Swift 4

By : jay ni
Date : November 21 2020, 03:00 PM
this one helps. I'm trying to port Objective C code to Swift 4 for some reasons. , The streamEvents parameter would be:
code :
CFOptionFlags(CFStreamEventType.openCompleted.rawValue |
              CFStreamEventType.hasBytesAvailable.rawValue |
              CFStreamEventType.endEncountered.rawValue |
              CFStreamEventType.errorOccurred.rawValue)


Share : facebook icon twitter icon
CFUserNotificationDisplayAlert CFOptionFlags Not working?

CFUserNotificationDisplayAlert CFOptionFlags Not working?


By : Srawan
Date : March 29 2020, 07:55 AM
wish of those help
The CFUserNotification API is not available on iOS. Looks to me like you copied that bit of code from a Mac App.
Could not cast value of type 'Swift.Array<Swift.Dictionary<Swift.String, Swift.String>>' () to 'Swift.Dictio

Could not cast value of type 'Swift.Array<Swift.Dictionary<Swift.String, Swift.String>>' () to 'Swift.Dictio


By : joseph
Date : March 29 2020, 07:55 AM
around this issue This is my JSON, when i read ord , uniq data i'm getting errors , To get count you need to do...
code :
if let res = response2["Response"] as? [String: Any], let arr = res["Array"] as? [[String: Any]] {
  print("array count = \(arr.count)")
} else {
   print("Array not found !!")
}
var ord_id: [Any] = []

if let res = response2["Response"] as? [String: Any] {
    if let arr = res["Array"] as? [Any], arr.count > 0 {
      print(arr)
      ord_id = arr
    }
}
var ordId_arr = [String]()
var uniq_arr = [String]()

for obj in ord_id {

 print(obj)

 if let dict = obj as? [String: Any] {
    //print(dict["ord"] as! String)
    //print(dict["uniq"] as! String)
    //print(dict["name"] as! String)
   //you can get other values in same way

   if let ord = dict["ord"] as? String {
        ordId_arr.append(ord)
    }

    if let uniq = dict["uniq"] as? String {
        uniq_arr.append(uniq)
    }
 }

}

print("\(ordId_arr)")
print("\(uniq_arr)")
Could not cast value of type 'Swift._SwiftDeferredNSDictionary<Swift.String, Swift.Double>' (0x11b1b84f8) to 'NSMu

Could not cast value of type 'Swift._SwiftDeferredNSDictionary<Swift.String, Swift.Double>' (0x11b1b84f8) to 'NSMu


By : programistha
Date : March 29 2020, 07:55 AM
it helps some times NSDictionary is not directly castable to NSMutableDictionary. The types are different.
You probably need something like this:
code :
fetch(withDetails: NSMutableDictionary(dictionary: parameters), ...)
Swift 5 breaking my native module export, with error Swift class extensions and categories on Swift classes are not allo

Swift 5 breaking my native module export, with error Swift class extensions and categories on Swift classes are not allo


By : Merxuri
Date : March 29 2020, 07:55 AM
around this issue Had the same issue. If you will notice , when you run the app on a real device it will work fine. The problem is in the pods, do pod update.
Can I downgrade swift version to moderate error 'Module compiled with Swift x.x cannot be imported by the Swift x.x comp

Can I downgrade swift version to moderate error 'Module compiled with Swift x.x cannot be imported by the Swift x.x comp


By : Er Abhishek Gour
Date : March 29 2020, 07:55 AM
hop of those help? The swift 5 compiler which is bundled with Xcode 10.2 can compile in swift 4 mode. However, it is still the swift 5 compiler and not the swift 4 compiler that came in Xcode 10.1. Modules built with the swift 4 compiler can’t be imported by the swift 5 compiler.
Therefore, the two options you listed are the only options you have.
shadow
Privacy Policy - Terms - Contact Us © voile276.org