XCode AutoComplete current iPhone SDK, non-deprecated version? - iphone

Is there a way to configure XCode to autocomplete Cocoa methods with the most current, non-deprecated versions?
For instance
NSString *myString = #"Hello";
//xcode sets autocomplete to look like this
[myString writeToFile:arg1 atomically:arg2];
//however that gets a warning from the debugger
//the method is deprecated. the new method is:
[myString writeToFile:arg1 atomically:arg2 encoding:arg3 error:arg4];
I haven't mastered the memorization yet and I have been moving along by just using autocomplete and checking documentation when there is a problem. I wonder why the default xcode configuration for the newest iPhone SDKs autocomplete with deprecated methods. Can it be changed?

When typing and you see autoComplete start to show the next part, hit the escape key, and you can see the available completions. Type one letter and see a bunch. Hit escape again to hide it.
But that doesn't really answer your question on deprecated methods...

Related

Swift WKWebView continuous spell checking

We have an embedded HTML form type editor in a macOS app that needs to be filled by the user. We are using WKWebView with Swift and it's all working fine but we are not able to get the spell check working in WKWebView. I mean it does work and corrects some words but doesn't show red dotted underline on misspelled words like WebView.
WebView shows dotted redline where WKWebView does not. Found that WebView has property as isContinuousSpellCheckingEnabled but no such property is available in WKWebView.
My simple requirement to highlight misspelled words, please help if there's anything available.
I did not found it yet: so far no such property is available in WKWebView.
From apple
Description Daniel Bates 2018-08-21 11:23:20 PDT
We should render misspelled words with the spelling correction dots in
iOS WebKit (i.e. when using WKWebView). Currently we only support this
in iOS WebKit Legacy (i.e. when using UIWebView).

Xcode 4.3.2 - refering from a Text Field to a string member

I am new to Xcode and Objective-C. I could see a demo that make such a reference from a text field on the View to a string member of the class such that whenever the string is changed the contents of the Text Field is changed too. However this demo is not with the latest Xcode and I cannot find how to do the same with Xcode 4.3.2.
Thanks
This has nothing to do with XCode, this is objective-c. XCode is just an code editor.
What you are looking for is an observer. Add an observer to you NSString and whenever it gets changed you can update your UITextField. I think I have some code somewhere that does that, I'll see if I can find it.
edit
Here is a link to the a question I made once upon a time: Adding an observer to an NSString

Leaks in UIPasteboard objects

I see a lot of leaks in several UIPasteboard objects. Until today, I never heard of this class and (obviously) didn't use one myself in the program. Here's a screenshot:
What can I do to get rid of these leaks? Am I even looking at this problem correctly?
make sure to check if the problem is a UIPasteBoard instance in any 3rd party code used.
Without a stack trace, you can't do a whole lot.
UIPasteboard is used for implementing copy&paste. On the desktop it's also used for drag&drop. Besides these two tasks, I'm not really sure what else people commonly use it for, but it is a way to send snippets of data between apps (assuming both apps know to look at the pasteboard).
If this is not an application pasteboard that you have set than it is a system pasteboard so you will need to access the generalPasteBoard than get all its items and all the types for those items and set their string and data values to nil.
generalpasteboard UIPasteBoard *pb = [UIPasteboard pasteBoardWithName:UIPasteboardNameGeneral];
for (UIPasteBoardItem *pbItem in [pb items]) {
for (NSString pbType in [pbItem pasteboardTypes]) {
[pbItem setData:nil forPasteboardType:pbType];
[pbItem setValue:nil forPasteboardType:pbType];
}
}
try putting this at the beginning of your application.... Still its strange that the general pasteboard is leaking... By the way, it may also be the find pasteboard UIPasteboardNameFind (also a system pasteboard)
Note that this is for finding out if it is the general pasteboard not using in the final distributed app. Also make sure to check if the problem is a UIPastBoard instance in any 3rd party code used.

UITextView Puzzle?

In one project XCode4 intellisence feature shows setContentToHTMLString method of UITextView but in other project intellisence feature not showing setContentToHTMLString this method of UITextView.
I want to use setContentToHTMLString method of UITextView for HTML-based Presentation-only in my textView this works in one Project but not showing even by the intellisence feature of UITextView.
Any Suggestion.
Thanks in Advance....
I don't know why Xcode has this changing behavior, but I would suggest you not to use that method, because it is in a private API, so your app would be rejected by Apple. Possibly the fact that it is private is also why sometimes it is showing (it should not), others it is not.
The way to go to display HTML content is either use a [UIWebView][2], with all its caveats, or try out Three20 styled text facilities, which are quite limited, though.

How to check spelling entered in textview?

I have one UITextview in which user enter text. after that i take that text as a string and display it in another textview and want the words which are grammatically incorrect.
How to do that?
Use the UITextChecker class that's been available since ios 3.2: Apple Documentation
iOS system only provide spell checking while the user is inputting text. If the user choose to type in the wrong word or words, iOS cannot help. If you want to perform your own spell checking, you will have to include your own spell checking library.
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell. It can either be used as a library or as an independent spell checker.
Aspell Spell Checker on iPhone? was asked a few years ago here on SO. I am not sure if they ever got it working.
Use autocorrectionType property of UITextInputTraits protocol which is implemented by UITextView
#property(nonatomic) UITextAutocorrectionType autocorrectionType
Use it as below
To disable
myTxtview.autocorrectionType = UITextAutocorrectionTypeNo;
To enable
myTxtview.autocorrectionType = UITextAutocorrectionTypeYes;
In Apple Documentation
You can use Correction option under Text Input Traits in TextField Attributes using Interface Builder. It will take care of Valid English words.