1

So iOS 6 deprecates presentModalViewController:animated: and dismissModalViewControllerAnimated:, and it replaces them with presentViewController:animated:completion: and dismissViewControllerAnimated:completion:, respectively. I suppose I could use find-replace to update my app, although it would be awkward with the present* methods, since the controller to be presented is different every time. I know I could handle that situation with a regex, but I don't feel comfortable enough with regex to try using it with my 1000+-files-big app.

So I'm wondering: Does Xcode have some magic "update deprecated methods" command or something? I mean, I've described my particular situation above, but in general, deprecations come around with every OS release. Is there a better way to update an app than simply to use find-replace?

JWWalker
  • 22,385
  • 6
  • 55
  • 76
Alex Basson
  • 10,967
  • 6
  • 29
  • 44
  • I found a solution for this in an older post: https://stackoverflow.com/a/15208449. It uses Xcode's find/replace using regular expressions. Worked great! – user1769627 Oct 01 '13 at 11:39

2 Answers2

0

You might be interested in Program Transformation Systems.

These are tools that can automatically modify source code, using pattern-directed source-to-source transformations ("if you see this source-level pattern, replace it by that source-level pattern") that operate on code structures rather than text. Done properly, these transformations can be reliable and semantically correct, and they're a lot easier to write than low-level procedural code that navigates and smashes nanoscopic actual tree structures.

It is not the case that using such tools is easy; such tools have to know how to parse the language of interest into compiler data structures, (e.g., ObjectiveC), process the patterns, and regenerate compilable source code from the modified structures. Even with the basic transformation engine, somebody needs to carefully define parsers (and unparsers!) for the dialects of the languages of interest. And it takes time to learn how to use such a even if you have such parsers/unparsers. This is worth it if the changes you need to make are "regular" (in the program transformation sense, not the regexp sense) and widespread (as yours seem to be).

Our DMS Software Reengineering toolkit has an ObjectiveC front end, and can carry out such transformations.

JWWalker
  • 22,385
  • 6
  • 55
  • 76
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
-1

no there is no magic like that

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • 1
    @downvoter I get that this is not a very helpful answer but given that there is no way using xcode, I feel that this is totally correct – Daij-Djan Jun 19 '14 at 07:38