swift3

Twitter Friendship/create api asking for authentication in swift

爷,独闯天下 提交于 2019-12-25 09:03:54
问题 I am trying post a follow the user but am still not able to hit post api POST https://api.twitter.com/1.1/friendships/create.json?user_id=1401881&follow=true. it is showing : Error: Optional(Error Domain=TwitterAPIErrorDomain Code=220 "Request failed: forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error : Your credentials do not allow access to this resource. (code 220), TWTRNetworkingStatusCode=403, NSErrorFailingURLKey= https://api.twitter.com/1.1/friendships/create.json

Error 'Missing required parameter : grant_type' using Swift 3

本小妞迷上赌 提交于 2019-12-25 08:59:40
问题 I am working on Twitter API and I want to get access_Token but I am getting this error: { "errors" : [ { "message" : "Missing required parameter: grant_type", "label" : "forbidden_missing_parameter", "code" : 170 } ] }. My request is below: let dict = ["grant_type" : "client_credentials"] requestPOSTURL("https://api.twitter.com/oauth2/token", params: dict as [String : AnyObject] , headers: ["Authorization" : "Basic " + strHeader, "Content-Type" : "application/x-www-form-urlencoded;charset=UTF

Value of type 'CGPoint' has no member 'makeWithDictionaryRepresentation' in swift 3

拈花ヽ惹草 提交于 2019-12-25 08:58:45
问题 I am working with Swift 3. In my code I am using Siri integration in Wallet App.I am getting an error in that App. I searched in google for it but I didn't find the solution for it. Here is my code: func createPath(_ points: NSArray) -> UIBezierPath { let path = UIBezierPath() var point = CGPoint() //CGPointMakeWithDictionaryRepresentation((points[0] as! CFDictionary), &point) point.makeWithDictionaryRepresentation((points[0] as! CFDictionary)) // In this line I am getting an error path.move

UITableViewController filling cells of different sections with Values

折月煮酒 提交于 2019-12-25 08:58:14
问题 I'm sure this question is asked before but I couldn't find a solution for it. I have a UITableViewController with static cells , I have 4 sections (so far) and each section only has 1 cell . this is a part of the first Cell of First section and this is the corresponding TableViewCell file, AllgemeineProduktdatenCell.swift class AllgemeineProduktdatenCell: UITableViewCell{ // MARK: - Outlets @IBOutlet weak var AngebotsnameTextF: UITextField! @IBOutlet weak var Referenznummer: UITextField!

Selected button of a UITableViewCell get disappear when scrolling

点点圈 提交于 2019-12-25 08:54:04
问题 I'm working on a project coded in swift 3 and I have a UIButton inside a UITableViewCell where the image changes once the button is tapped. Though the selected buttons get selected as intended, once the UITableview scrolls the selected images gets disappear since the cells are been reused. As I'm new to programming having troubles of writing the logic. Help would much appreciate the code as bellow. CellFoRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->

How to handle custom url schemes in swift (XCode 8)?

浪尽此生 提交于 2019-12-25 08:50:01
问题 I tried using this function to receive the parameters from the custom url: func application(_ application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { return true; } However, the function is never called and I receive warning: "Instance method 'application( :openURL:sourceApplication:annotation:)' nearly matches optional argument 'application( :open:sourceApplication:annotation:)' of protocol 'UIApplicationDelegate. Based on XCode 8 Warning

Get images from Document Directory not file path Swift 3

时光毁灭记忆、已成空白 提交于 2019-12-25 08:48:31
问题 This is how I saved the images let format = DateFormatter() format.dateFormat="MMMM-dd-yyyy-ss" let currentFileName = "\(format.string(from: Date())).img" print(currentFileName) // Save Images let fileMgr = FileManager.default let dirPath = fileMgr.urls(for: .documentDirectory, in: .userDomainMask)[0] let imageFileUrl = dirPath.appendingPathComponent(currentFileName) do { try UIImagePNGRepresentation(returnedImages)!.write(to: imageFileUrl) print("Image Added Successfully") } catch { print

how can I expand the hit area of a specific UIButton in Swift?

跟風遠走 提交于 2019-12-25 08:44:22
问题 In my application I have a UIButton that is quite small, so I thought about increasing the hit area of it. I found an extension for that: fileprivate let minimumHitArea = CGSize(width: 100, height: 100) extension UIButton { open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { // if the button is hidden/disabled/transparent it can't be hit if self.isHidden || !self.isUserInteractionEnabled || self.alpha < 0.01 { return nil } // increase the hit frame to be at least

Contacts framework social profiles SIGABRT error in Swift

我们两清 提交于 2019-12-25 08:44:04
问题 I am trying to save information to my contacts through programming and everything goes successful, however when I try to save social profiles I get this SIGABRT ERROR: 2017-01-23 00:10:11.323693 FVSCANNER[765:154249] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2017-01-23 00:10:11.325124 FVSCANNER[765:154249] [MC] Reading from public effective user settings. Could not

UITableView not displaying the correct number of sections and rows from the fetch request array result

人盡茶涼 提交于 2019-12-25 08:36:42
问题 I think my problem spans over multiple VC. In the table VC I perform a fetch request that returns an array of Floor objects. This entity has 2 attributes (floor number and number of rooms in floors). If I assign 2 floors (0 and 1) it works and prints them. The next VC contains a picker that displays the number of floors and a text box that is used to assign the number of rooms per floor. There must be a problem with this function because it gets called only if the first item of the picker is