swift3

UnsafePointer no longer works in swift 3

徘徊边缘 提交于 2020-12-08 07:05:21
问题 After I convert from swift 2 to swift 3, there is an error pop up for the below metioned line let value = UnsafePointer<UInt32>(array1).pointee 'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type. in swift2 it is like let value = UnsafePointer<UInt32>(array1).memory Can someone explain please? Sorry I'm quite new to swift3 After i have make the changes to let abc = UnsafePointer<UInt32>(array1).withMemoryRebound(to: <#T##T

UnsafePointer no longer works in swift 3

北城以北 提交于 2020-12-08 07:04:51
问题 After I convert from swift 2 to swift 3, there is an error pop up for the below metioned line let value = UnsafePointer<UInt32>(array1).pointee 'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type. in swift2 it is like let value = UnsafePointer<UInt32>(array1).memory Can someone explain please? Sorry I'm quite new to swift3 After i have make the changes to let abc = UnsafePointer<UInt32>(array1).withMemoryRebound(to: <#T##T

How Can I Access Local Https with invalid certificate With Alamofire?

末鹿安然 提交于 2020-12-06 16:04:04
问题 I'm trying to connect to a Webserver on a local network using Alamofire. If I open the url with a browser, it gives a ssl warning. If I just ignore and add the exception to the browser, it definitely works. I read different posts on this topic including Alamofire Github page, but I wasn't able to get it to work. What am I doing wrong? Thanks in advance! Here is the testing code: I declared the manager in the beginning of the code right below class ViewController. let manager = SessionManager

How Can I Access Local Https with invalid certificate With Alamofire?

我怕爱的太早我们不能终老 提交于 2020-12-06 16:01:29
问题 I'm trying to connect to a Webserver on a local network using Alamofire. If I open the url with a browser, it gives a ssl warning. If I just ignore and add the exception to the browser, it definitely works. I read different posts on this topic including Alamofire Github page, but I wasn't able to get it to work. What am I doing wrong? Thanks in advance! Here is the testing code: I declared the manager in the beginning of the code right below class ViewController. let manager = SessionManager

How to add external .vtt subtitle file to AVPlayerViewController in tvOS

天大地大妈咪最大 提交于 2020-12-04 08:55:34
问题 Question: How do I add an external WebVTT file to my AVPlayer in tvOS? Description: I've been watching this "What's New in HTTP Live Streaming" by Apple where they talk about different ways in implementing an external WebVTT file. The whole subtitle domain is quite new to me, so I'm having hard time grasping the concept quite well. Within the video they talk about many different things which I do not quite understand such as ( Subtitle playlist ). However, getting passed all that my main

Extract data from kCBAdvDataManufacturerData on Swift

本秂侑毒 提交于 2020-12-03 07:53:41
问题 I have a TI sensor Tag as a peripheral that broadcasts BLE data in the form of kCBAdvDataManufacturerData. I would like to extract different values from this data in iOS. I am executing the following in Swift: func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber){ for (index, foundPeripheral) in peripherals.enumerated(){ if foundPeripheral.peripheral?.identifier == peripheral.identifier{ peripherals[index

Extract data from kCBAdvDataManufacturerData on Swift

狂风中的少年 提交于 2020-12-03 07:50:28
问题 I have a TI sensor Tag as a peripheral that broadcasts BLE data in the form of kCBAdvDataManufacturerData. I would like to extract different values from this data in iOS. I am executing the following in Swift: func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber){ for (index, foundPeripheral) in peripherals.enumerated(){ if foundPeripheral.peripheral?.identifier == peripheral.identifier{ peripherals[index

Bounding rect of multiline string in UILabel swift

余生颓废 提交于 2020-12-03 03:40:50
问题 I have been trying for hours now to find the boundingRect of a string in a UILabel I have, but nothing seems to be working. From what I understand, boundingRect returns the size of the actual text in the label, not the label's size or something like that. This is true, right? I have a UILabel called messageLabel which contains some text that wraps to an unlimited number of lines. The code I have now is this: let labelRect = (message as NSString).boundingRect(with: messageLabel.frame.size,