Dear all I have this problem:I have a table view with some row, in every row there is a button, a when it is submitted, I have to make some update (php) via json.My problem is that I'm not able to get the indexpath row to clean the table after the php update.Does anyone encountered the same problem and can help me?Thanks in advance,Angelo.
Post not yet marked as solved
I am a solo developer at a government agency. This presents some interesting challanges. First and foremost, I create apps that are not able to access internet resources, and thus I don't have access to some tools that would provide the easy answer to a lot of my problems.My current problem is that I don't have the ability to use some of the very robust error handeling products out there. However, I need a way to capture crashes on devices that are not teathered to my workstation. I need robust reporting and the ability to see logs for anything that happened on devices that are deployed in places that are not accessable to me easily (think maximum security portion of a ****).My current thought is capturing every error and sending it to an internal webservice. However, I don't know how to do this without surronding every single line in a try catch. Does anyone have any experience with this, or with something else entirely that would get me the information I need to debug crashes?Thanks in advance
Post not yet marked as solved
I'm creating an app that uses WKWebView. Whenever a user clicks on a link in that webview, I want the link to open up in safari instead of inside the webview. I'm really new at coding, so please make it as easy as possible. I just need the code I need to add. Here's the code bellow:import UIKit
import WebKit
class FirstViewController: UIViewController {
@IBOutlet var containerView: UIView! = nil
var webView: WKWebView?
override func loadView() {
super.loadView()
self.webView = WKWebView()
self.view = self.webView!
}
override func viewDidLoad() {
super.viewDidLoad()
var url = NSURL(string:"http://www.example.com/")
var req = NSURLRequest(url:url as! URL)
self.webView!.load(req as URLRequest)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}I'm using Xcode 8 and Swift 3
Post not yet marked as solved
I am working with Swift 3 and have a Timer object running which is counting for the duration of a specific task in a list. When that task completes, it moves onto the next task.The tasks are shown in a UITableView which the user can scroll through whilst the top task is being processed. I have noticed that when scrollling through the table, this seems to impact the firing of the timer (interval is 1 sec) and over the course of working on a number of tasks it is losing time. At the start, I calculate how long the overall list of tasks will take to finish and show this as a target completion time. If I don't do any scrolling, the tasks complete exactly on time. If I scroll about, the tasks finish late.I have been looking online for solutions and there seems to be examples of this in Swift 2 which uses NSTimers and NSRunLoop to help get around this. I tried something similar in Swift 3 with RunLoop but doesn't seem to help.Any pointers?Thanks,Rob.
Post marked as Apple Recommended
I have a C struct that stores a MAC address as an array of 6 unsigned characters (u_char) i.e.u_char mac[6];In swift this array is seen as a tuple (UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)I want to store this tuple into a Swift array in the fastest way possible. Currently I am using memcpy but wondered if there is a more Swiftified way of doing this without sacrificing speed. var dst_mac: [u_char] {
var a = [u_char](repeating: 0, count: 6)
var mac = m_flow.dst_mac
memcpy(&a, &mac, 6)
return a
}
Hello, I'm trying to save some Strings in a csv document: var tempString = String()
for Rezept in alleRezepte {
tempString += "\(Rezept.name), \(Rezept.description), \(Rezept.nutrients), \(Rezept.whatToDo)\n"
}
let dirs = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true) as? [String])
let path = dirs?[0].appending("rezepte.csv")
let url = URL(string: path!)
do {
try tempString.write(to: url!, atomically: true, encoding: String.Encoding.utf8)
} catch {
print(error)
}
print("Daten gesichert")And I get this error:CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no schemeError Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported."How can I fix this?Thank you for helping.
Post not yet marked as solved
In Apple's crash organizer, I'm seeing a handful of crash reports come in. It doesn't appear to be a widespread issue, but keeps happening now and again.Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: @rpath/libswiftCoreGraphics.dylib | Referenced from: /var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/myapp | Reason: no suitable image found. Did find: | /private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib: code signature invalid for '/private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib' |
Triggered by Thread: 0
Thread 0 Crashed:
0 dyld 0x00000001004d5cbc __abort_with_payload + 8
1 dyld 0x00000001004d5668 abort_with_payload_wrapper_internal + 100 (terminate_with_reason.c:71)
2 dyld 0x00000001004d5694 abort_with_payload + 12 (terminate_with_reason.c:93)
3 dyld 0x00000001004b4514 dyld::halt(char const*) + 320 (dyld.cpp:4487)
4 dyld 0x00000001004b69a8 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4072 (dyld.cpp:6110)
5 dyld 0x00000001004b1044 _dyld_start + 68A couple of versions ago, I saw a similar crash with libswiftCoreMedia.dylib instead of Core Graphics.Any thoughts on what I can do to mitigate this or stamp it out?
Post not yet marked as solved
I would like to use the AirPods for some accessibility features but cannot find any reference to an available api. Is access to the hardware available?
Post not yet marked as solved
I’d like to develop an online marketplace and service provider iOS app similar to the Airbnb app for my startup company. I need standard functions like email registration, user profile, listings etc. And special functions like: location tracking, map, booking system, embedded messenger for the host and customers, internet surveillance camera and rating system, payment system.I have two questions:-How much does it cost?-Is it possible to develop it by myself and how long?(no programming background)
Post not yet marked as solved
I got this message after I try to validate the app. I was trying to validate it first before uploading to ituneconnect. Is there issue with the server being busy?
Post not yet marked as solved
I'm just getting into development on mac os and I made a simple app for the touch bar that allows you to change the color (with a nscolorpicker) of a label that is also on the touch bar.Now I would like to get the same effect on the actual window like so: I change the color using the picker on the touch bar and the color of the colorwell in the window changes as well.This is the code that I currently have for the touch bar actions:import Cocoa
@available(OSX 10.12.2, *)
class MainWindowController: NSWindowController {
@IBOutlet weak var cptHello: NSColorPickerTouchBarItem!
@IBOutlet var lblHello: NSTextField!
override func windowDidLoad() {
super.windowDidLoad()
/
cptHello.color = NSColor.white
setCol()
}
func setCol(){
lblHello.textColor = cptHello.color
}
@IBAction func colorPicked(_ sender: Any) {
setCol()
}
}This piece of code resides in MainWindowController.swift which is paired with the window controller.In the view controller, I have a single NSColorWell that I would like to change the color for inside the function "setCol()". I created an outlet in the view controller for it like so:@IBOutlet var cwHello: NSColorWell!So ideally what I want to achieve is something like this: func setCol(){
lblHello.textColor = cptHello.color
ViewController.cwHello.color = cptHello.colr
}Can this be done at all?
Post not yet marked as solved
How do I sort an array of dictionary objects based on the value of the dictionary? I understand I should use the sorted method of the array, but I don't understand the notation that uses $0.1 and $0.0. Where is the documentation on that?
For the app I'm working on, what I'd like would be that when the view show, the pickerview view is already at a certain row, and that I don't need to touch it (unless I need it).I know there are plenty of question like this one on SO, but I couldn't find my answer.Right now here is what's done and what works:When the view appears, the UIPickerView is at the preselected row (ie 2nd for example)I can change it to another one and save it.But, when I try to save without touching it, it's like nothing is selected. I've to touche the PickerView to select the row I want, even if it's the one I "Selected" at first.I'm selected the row with :pickerViewAction.selectRow(inPickerViewAction.index(of: temp?[0] as! String)!, inComponent: 0, animated: true)WhereinPickerViewAction.index(of: temp?[0] as! String)!is the row I need.How I test if a row is selected (maybe my problem comes from here, I don't know...)let selectedValue1 = inPickerViewAction[Row]
switch selectedValue1 {
case "Email" :
// DOING MY STUFF
case "Commande http", name1, name2, name3, name4, name5:
//DOING MY STUFF
default: let alert = UIAlertController(title: "Nothing selected", message:"You must select an item before saving", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil) breakRight now if I don't touch the UIPickerView, I've the UIAlert that show.If anyone have an idea, that'd be great. Thanks
Post not yet marked as solved
Hey guys,I have a bluetooth app that connects to a device. What I want to achieve is this: when a user switches apps or goes to the homescreen, I want to disconnect from the bluetooth device but when a user hits the lock screen, I want the bluetooth connection to be maintained. I am not super familiar with swift and ios dev so any advice would be great.Is there a way to determine whether a app is backgrounded due to the user going to the homescreen and when a user simply locks the phone?Thanks in advance.
Post not yet marked as solved
Hi, how do I make a button so that when it is pressed, it calls a phone number?
Post not yet marked as solved
Now I'm writing the unit tests. There is a problem to test the WKWebView. Do you know how to execute the navigationDelegate methods. I have tried like this, but it crashed. Could you please help me? Thanks in advance. let wkNavigation = WKNavigation() let error = NSError() vc.wkWebView?.navigationDelegate?.webView!(vc.wkWebView!, didFail: wkNavigation, withError: error)
Post not yet marked as solved
in the playground 9.1 im learning Xcode. at lesson 10, i can't understand argument label and parameter name.could please explain them to me VERY easily.for example i didn't understand the Exercise: argument label below:what should i do now?thank you.../:
## Exercise: Argument Label
Functions and their arguments should be named so that they read like a clear instruction when they’re called. To make this easier, you can give parameters two names - an _argument label_ to be used when calling the function and a _parameter name_ to be used within the function’s body.
*/
func score(reds: Int, greens: Int, golds: Int) -> Int {
let pointsPerRed = 5
let pointsPerGreen = 10
let pointsPerGold = 30
let redScore = reds * pointsPerRed
let greenScore = greens * pointsPerGreen
let goldScore = golds * pointsPerGold
return redScore + greenScore + goldScore
}
let finalScore = score(reds: 5, greens: 3, golds: 3)
/:
- callout(Exercise): Add an argument label to the function definition so it reads like this when you call it:\
`let finalScore = score(withReds: 5, greens: 3, golds: 3)`
*/
//: [Previous](@previous) | page 16 of 17 | [Next: Exercise: No Argument Label](@next)
Post not yet marked as solved
Hey guys,Programming environemnt :swift version : 4.0xcode version : 9.2My objective :1- Open a web application in ios and2 - Communicate with its elements using JavaScript - invoke a method in my native appwhat I have done so far :I can load my application using webkit view.challenges : I found few old instructions for invoking native code from web applications JS functions which sadly won't work in newer versions of swift. due to swift upgrade. function/methods like : NSBundle that are no longer available.Main Question :how can I invoke a method in native app from JavaScript Thank you
Post not yet marked as solved
Apple developed Project files from Intro to App Development Lesson 16 on QuestionBot 2 are giving me errors as follows:The project will build and run fine. It will also answer the first question. However, asking a 2nd question causes an error of "Thread 1: signal SIGABRT". This is a file straight from the Apple Tutorial. Suggestions?Project files give warnings for depricated code are given as follows: "The use of Swift 3 @objc inference in Swift 4 mode is deprecated." Suggestions?Thanks,Mike
Post not yet marked as solved
this is super frustrating.I have a class, it's one of hundreds.eariler today, it worked fine. I have made no changes. The editor seems to think I have overriden the superClass's method. (you can find that out by just doing it again and looking at the error messages)But, when I compile. my override is never called. In the OTHER subclasses it is called. I have cleaned and recompiled the entire project. I have re-written the method from scratch. I have copied the method from the super class, and pasted it into the subclass, adding the "override" key word.this is not the first time this has happened.