iOS uses reveal to debug interface 2--real-computer debugging

Source: Internet
Author: User

Using the real machine to debug our app interface, if your real machine is a device without jailbreak, then the steps to debug the UI with reveal are the most troublesome.
Open Reveal's library location
take reveal's library
Drag the library into the project

1, such as " drag library into the project" as shown in the figure, the reveal library dragged into our project.


Select a method to add

2. Do not add the library to the target of our app, as shown in " Choose method to add" .


Add to bundle Resource

3. Add the reveal library to the bundle Resource, as shown in the " Add to bundle Resource" Figure .


Select Add to Bundle Resource

4, such as " Select Add to Bundle Resource" as shown, select the corresponding reveal library to bundle Resource.


add reveal library success

5, as shown in the " Add reveal Library success " figure, when the bundle resources appeared reveal library, it was added successfully.


add a corresponding system library

6. Add the System libraries required for the reveal runtime, as shown in " adding a corresponding system library ."


add reveal Run script

7, such as " Add reveal Run script " as shown, next is to add reveal run script, is not feeling the trouble, if you have a better way to debug non-jailbreak the method of the real machine Welcome to inform me, thank you!


write the script corresponding to the reveal

8, such as " write reveal corresponding script " as shown, write to reveal run time required script, the script content is as follows:

Set-e

If [-N "${code_sign_identity}"]; Then

Codesign-fs "${code_sign_identity}" "${built_products_dir}/${full_product_name}/libreveal.dylib"

Fi


Load Method
invoke the Load method in the life cycle method

9, as shown in the " loading method " diagram, you need to write the corresponding reveal loading method in Appdelegate, I use the swift version, of course, there are OC version. Then, as shown in the " invoke Load method inside the lifecycle method " diagram, you need to invoke the reveal loading method within the lifecycle method. The various version loading methods are now available (note that you should not load reveal in the release version, as it is only suitable for debugging):

Swift:

MARK:-Reveal func loadreveal () {if nsclassfromstring ("ibarevealloader") = = Nil {Let Reveallibname = "libreveal"// or "Libreveal-tvos" for TvOS targets let reveallibextension = "Dylib" var error:string? If Let Dylibpath = Nsbundle.mainbundle (). Pathforresource (Reveallibname, oftype:reveallibextension) {print ("Loading Dynamic library \ (Dylibpath)) Let Reveallib = Dlopen (Dylibpath, rtld_now) if reveallib = = Nil {error = String (utf8string  : Dlerror ())}} else {error = "File not found."} if Error! = Nil {Let alert = Uialertcontroller (title: "Reveal Library Could not being loaded ", message:" \ (reveallibname). \ (reveallibextension) failed to load with error: \ (error!) ", PREFERREDST YLE:. Alert) alert.addaction (uialertaction (title: "OK", Style:.) Default, Handler:nil)) uiapplication.sharedapplication (). Windows.first?. Rootviewcontroller?. Presentviewcontroller (Alert, Animated:true, Completion:nil)}}

objective-c:

#import #pragma mark-reveal-(void) Loadreveal {if (nsclassfromstring (@ "ibarevealloader") = = nil) {NSString *reveallib Name = @ "Libreveal"; or @ "Libreveal-tvos" for TvOS targets nsstring *reveallibextension = @ "Dylib"; NSString *error; NSString *dylibpath = [[NSBundle mainbundle] Pathforresource:reveallibname oftype:reveallibextension]; if (dylibpath! = nil) {NSLog (@ "Loading Dynamic Library:%@", dylibpath); void *reveallib = Dlopen ([Dylibpath cstringusing Encoding:nsutf8stringencoding], Rtld_now); if (reveallib = = NULL) {error = [NSString stringwithutf8string:dlerror ()];}} else {error = @ "File not found.";} if (Error! = nil) {NSString *message = [NSString stringwithformat:@ "%@.%@ failed to load with error:%@", Reveallibname, Reveallibextension, error]; Uialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@ "Reveal library could not being loaded" message: Message Preferredstyle:uialertcontrollerstylealert]; [Alert addaction:[uialertaction actionwithtitle:@ "OK"Style:uialertactionstyledefault Handler:nil]]; [[[[[[UIApplication sharedapplication] windows] firstobject] Rootviewcontroller] Presentviewcontroller:alert animated : YES Completion:nil]; } } }


Successful Run Results10, ensure that your computer and your real machine in the same network segment, and then run your app, select your device in reveal, wait a moment, your reveal will appear the corresponding UI, such as " Successful Run Results"The interface is shown (my device is the ipad). Use cmd+r shortcut keys to refresh your reveal interface.

Non-jailbreak real machine debugging is the most troublesome, before the real machine can also use breakpoints to debug, and now can not be used. No longer tangled in this, if your device is jailbroken equipment, then congratulations, you want to use reveal is simply add Esay. Click the link to open a button configuration, with reveal loader with reveal debugging app will be pleasantly surprised. This is a reveal plugin developed by Richard Heard, you just need to install this plugin to make sure your PC is in the same network segment as your real computer, and then select any app you want to debug (yes, not your own home app can do it, only you can't imagine, No you can't see, hahaha, great benefits).

iOS uses reveal to debug interface 2--real-computer debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.