Posts by Rafael Leão • 1,839 points
60 posts
-
3
votes1
answer45
viewsA: How to resolve this problem: Expected '{' in body of Function declaration
The call to the method print has to be made from within some method of its class: class ForecastingViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() print("Hello…
-
3
votes1
answer403
viewsA: What is the difference between Codable and Decodable
The Decodable protocol is implemented to define the decoding (deserialization) of the object from an external representation such as JSON, XML or Plist. Encodable is exactly the opposite, where it…
-
1
votes1
answer58
viewsA: Sectionheader tableview Swift
If you have not implemented the numberOfSectionsInTableView:method, tableView by default has a section and 'n' cells, where 'n' is the number of elements in the array 'notificationStore.items'.…
-
4
votes1
answer139
viewsA: Close app on Swift
There are several ways to finish the application on Swift, for example: exit(0), abort(), assert(false) However, this goes against the guidelines from Apple and will cause the app to be rejected in…
-
3
votes2
answers79
viewsA: Action after back background application
Complementing Rodrigo’s response, despite the viewDidAppear be a possibility, this method not called when the app returns in the background. Actually viewDidAppear is called when the Viewcontroller…
-
0
votes2
answers511
viewsA: iOS: open pdf of webview in browser OR download pdf
Here’s an outline solution to your problem. The method downloadPDF downloads the file and saves to the device, using the class Filedownloader. The PDF will be saved inside the folder Documents. The…
-
1
votes1
answer67
viewsA: What is the difference in terms of Uiviewcontroller and Sfsafariviewcontroller navigation?
A recurring situation in mobile development is showing the content of a web page. Basically there were two solutions to this problem. The first was to open the link in the Safari app, which is quite…
-
2
votes1
answer233
viewsA: Error when converting string to date, with dateformatter in Swift
The problem occurs due to the way that Dateformatter converts the date. When converting strings that have no time set, Dateformatter midnight. Timezone is also inferred by device settings (in your…
-
2
votes1
answer137
viewsA: How to get a unique device identifier from IOS
One possible solution is to save the handle in Keychain. This way there is how to recover it if user delete the app and install again. There are some libraries that implement this functionality, for…
-
1
votes1
answer27
viewsA: How to pass parameter in Nsarray in Nsurlsessiondownloadtask url
The error occurs when passing a null parameter to the Jsonobjectwithdata method. Probably the file download is failing and when the completionHandler is called the value of Location is nil. As good…
-
8
votes1
answer364
viewsA: What is the difference between viewDidLoad and awakeFromNib?
awakeFromNib is a method of NSObject and is called so that the object is created from an Interface Builder file (e.g. xib) viewDidLoad is a method of UIViewcontroller called after the Viewcontroller…
-
0
votes1
answer235
viewsA: Load web page in Uiwebview Swift 3
iOS has a security layer called App Transport Security (ATS) which by default blocks insecure connections (HTTP). The ideal is to implement the secure connection on the server side, as unsafe…
-
0
votes1
answer40
viewsA: Error while clicking Button
If the app is initialized and only when clicking on the button happens the crash, probably the problem is in the way the button click action was configured. Open the storyboard file (or xib if…
-
4
votes1
answer168
viewsA: Load Webview in Objective c
Missing connect the interface 'view' outlet with File’s Owner. The same way you did with 'webView'.
-
1
votes2
answers66
viewsA: How do I Alert message Uialertcontroller
In Swift 3, the method presentViewController(_:Animated:Completion:) was replaced by (present_:Animated:Completion:) self.present(myAlert, animated: true, completion: nil)…
-
3
votes1
answer86
viewsA: Automate publishing iOS apps
There is a lib called Fastlane, which also works for Android, in which it is possible to automate publishing tasks. In this link you find a tutorial, in English, on how to configure it.…
-
3
votes1
answer151
viewsA: How to update a Uiwebview to include and remove a Uiactivityindicatorview
You are on the right track Fábio. There are some things that may be preventing your code from working properly. For the Uiwebview delegate methods to be called it is necessary to pass to the webView…
-
0
votes1
answer234
viewsA: Change the Bundle Identifier of an app already published in the Appstore
Unfortunately not. Once approved and published, you can no longer modify the Bundle Identifier, as it is through it that iTunes Connect realizes that you are sending an update, not a new app. Link…
-
0
votes1
answer263
viewsA: Set invisible button after running Uitableview
Using tags to find views should be avoided as it makes code hard to understand. In your particular case, when viewWithTag: is called in the cell with the button tag, it can return any view type, not…
-
0
votes1
answer117
viewsA: Lib from image gallery
There are numerous libraries that implement this functionality. I quote here two Mwphotobrowser and Idmphotobrowser. Both work with local and also remote images, downloading and caching these.…
-
0
votes1
answer1456
viewsA: How to pass data from one Viewcontroller to another Viewcontroller
There are various ways to pass information between objects and the right way will depend on the characteristics of the application. Using properties of: Usually used when the die is passed only…
-
1
votes2
answers78
viewsA: Why is my request blocking events?
Gabriel, it’s not very clear to me exactly what the problem is. From what I understand you want to make the request and as soon as it is finished make a screen transition. There are several…
-
2
votes1
answer290
viewsA: How to use an imgLoad before loading Webview
Implement the delegate of Uiwebview to receive its status changes. When you start loading the webview you put something on the screen (image, Activity Indicator, HUD). When it finishes loading,…
-
4
votes1
answer91
viewsA: Recover project(application) installed on Iphone - Xcode
Not possible. When compiling the project, Xcode generates a file. ipa containing compiled code (executable) along with resources (images, plists, etc.). The most you can get is to extract ipa as zip…
-
4
votes1
answer335
viewsA: What is it and how do I use it? What do I use Viewdidload for?
It’s a class method Uiviewcontroller which is called as soon as the view controller view hierarchy is loaded, but is not yet visible on the screen. This method is called once during the view…
iosanswered Rafael Leão 1,839 -
2
votes2
answers213
viewsA: webView on iOS is not accessing some websites
iOS 9 by default blocks HTTP connections. To enable them, open the Info.plist file in text mode (right click, Open As/Source Code) and add the following configuration inside the dictionary, at the…
-
0
votes2
answers204
viewsA: Swift - Add button show password
To capture touches on Imageview you can add a Tapgesturerecognizer. Example: override func viewDidLoad() { super.viewDidLoad() ... imageView.userInteractionEnabled = true let gestureRecognizer =…
-
2
votes1
answer186
viewsA: Invoke touchInside method via SWIFT programming
Uibutton extends Uicontrol, which uses the concept of target/action for the treatment of events. Action is basically a method that will be triggered when the event occurs. Target is the object that…
-
4
votes2
answers194
viewsA: How to make Uitextfield track keyboard level when typing
The library Tpkeyboardavoiding does that job. After adding the library to the project, modify the class of the Uiscrollview object you had already added to Tpkeyboardavoidingscrollview.…
-
0
votes2
answers87
viewsA: How to make Textview track writing
I recently had a similar problem and used the library Tpkeyboardavoiding to solve it. This library automatically moves the text boxes off the keyboard. To use it place the textViews inside a…
-
1
votes1
answer166
viewsA: Textview IOS Swift - Balloon-shaped design
If you will show an isolated message, you can do it using a standard Uitextview with a Uiimageview behind it. Textview has a transparent background and contains only text. Imageview contains the…
-
3
votes5
answers2115
viewsA: How to make the keyboard disappear when click out of it? Swift
A possible solution is to detect the click off the keyboard using a GestureRecognizer. Then call the method resignFirstResponder in the instance of textfield or call endEditing that forces any view…
-
0
votes1
answer48
viewsA: Error with switch in Swift
The syntax error appears because the switch is declared in the class body. The switch must be declared within some method, e.g.: class ViewControllerAnalseOP1: UIViewController, UITextViewDelegate {…
-
1
votes2
answers239
viewsA: How do I see a view inside the Viewcontroller after pressing a button?
To hide/show a runtime view you use the property hidden of Uiview. Example: @IBAction func buttonClicked(sender: UIButton) { myView.hidden = true } In this example, myView is the reference to the…
-
2
votes2
answers106
viewsA: Xcode cannot find button
Fabio, I made a very simple example of capturing click on a button: I created a project "Single View Application" In the Viewcontroller. m file, I implemented the callback for the click In the…
-
2
votes2
answers79
viewsA: How to Create a Slide Side Out Submenu
This functionality must be implemented in the tableView itself. There are several libraries that implement this functionality of expanding and shrinking cells into a tableView, also known as…
-
2
votes1
answer914
viewsA: How to calculate the distance between two location points?
From two objects on Cllocation you get the distance, in meters, through the method distanceFromLocation. Example: CLLocationDistance distance = [location1 distanceFromLocation:location2];…
-
1
votes2
answers69
viewsA: viewDidAppear equivalent on apple watch
The life cycle of WKInterfaceController is still quite limited and only counts on the methods -willActivate and -didDeactivate. So if you need to run something a little bit after the method call…
-
1
votes1
answer72
viewsA: Icone Android opens browser with website
If you want an app installed by the Play store, you can create a native app (e.g., by Android Studio) that will contain only one screen (Activity). This screen will have a Webview element that will…
-
3
votes1
answer143
viewsA: Is it possible to run a Switch when the App is not running?
You can launch the app in the background, check the server and then trigger the notification using background fetch. The steps are as follows: In the project settings, in Capabilities, enable the…
-
1
votes1
answer75
viewsA: Implementation in Car class objective-C
You have set the year property twice. The correct form is using the modifier assign. Is used copy on objects that have a mutable counterpart, such as Nsstring - Nsmutablestring and Nsarray -…
-
0
votes1
answer64
viewsA: Colors in images
This library can help: https://github.com/fleitz/ColorArt With it you can extract information from the image, such as the background color. Example of use: UIImage *image = [UIImage…
-
0
votes2
answers300
viewsA: Read file . xlsm (Excel) from my application
If possible, convert the xls file to csv. Excel itself does this. Then you can use this library to read the file. https://github.com/davedelong/CHCSVParser…
-
1
votes2
answers119
viewsA: How to send data to web service using Afnetworking?
The error indicates that the json sent by the server contains fragments, which are not supported by the parser by default. To solve the problem, include this code after initializing the…
-
1
votes1
answer181
viewsA: How do I know the app’s web service is down?
For web service requests, the most used library is Afnetworking. It makes it easy to handle situations where the request fails, either because of connection or server problems. The library is…
-
3
votes2
answers272
viewsA: How to perform asynchronous request using JSON?
A simple way to execute background code is by using Grand Central Dispatch (GDC). The dispatch_async method executes a code block asynchronously and returns immediately, that is, it does not block…
-
1
votes1
answer50
viewsA: How do I show a Uialertview when a link is triggered in Uitextfield?
Implement the method - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange; of the delegate of Uitextview: - (void)viewDidLoad { [super…
-
1
votes1
answer134
viewsA: Show images with Cover Flow effect in Objective-C
There is no native component. You can build one using Uicollectionview with horizontal scroll, but it will be relatively laborious. I suggest using the library iCarousel It is very simple to use and…
-
1
votes1
answer456
viewsA: Splash screen on Ios
I suggest using Asset Catalogs. When creating a project, Xcode already creates such a file (Images.xcassets). If your project does not have one, add one. Open the file and in the list on the left…
-
1
votes1
answer71
viewsA: Open HTML with link using Nsattributedstring
The url does not open automatically in the browser because the protocol is not indicated. If you include the protocol, the link will be opened in Safari: @"<br>Dummy text<br>Click <a…