I work with old project and in some part of the project, the naming convention is not good so I want to change it.
For example:
@property (weak, nonatomi
If you are using Xcode Version 9.0 (release 9A235 or earlier beta) and you don't want to crash at UIApplicationMain() you will need to perform the following steps in order to rename an IBOutlet instance variable. (see below)
Steps:
do
while ( untouched related .xib files exist)
I wasted hours trying to figure out why the app was crashing in UIApplicationMain() after doing some mass refactoring of variable names. No logic changes, just hours of documenting, cleaning up structure for readability and just cleaning up names... not worth testing normally but when I decided to run.. BOOM
As it turns out, the (ahem) "release" of Xcode 9 does not manage to actually refactor IBOutlet instance variable names so you relegated to hand-jamming the .xib files. True refactoring would make all the necessary changes in the project...
Here is a regression tested example of how and what to do.
Example:
Select the IBOutlet instance variable, then right-click, select Refactor -> Rename... :
(step 1 and 2)
Now change the name. (for the example from textFieldController to editTextFieldController) :
(step 3)
Now for the critical part that Xcode neglects, change the custom outlet property in the XML:
(steps 4, and 5)
and then find the original variable (eg textFieldController) and change it to the new variable name (eg editTextFieldController)
(step 6)
... and then when you compile and run, it doesn't throw an exception / assertion in UIApplicationMain() ...