Difference between revisions of "Next Steps After Getting Started"

From iPhone Development Wiki
Jump to: navigation, search
(Add info and an example of %ctor)
m
Line 30: Line 30:
 
%ctor can be useful for performing any setup, for example, instantiating variables or reading your tweak's preferences.
 
%ctor can be useful for performing any setup, for example, instantiating variables or reading your tweak's preferences.
  
However, there are certain things which %ctor is '''not''' good for. For example, a naive mistake might be to attempt to display a UIAlertView from your %ctor, which would most likely be impossible (depending on the process you're loading in to) as it has not even bootstrapped yet, so attempting to display UI elements at this point is futile.  
+
However, there are certain things which %ctor is '''not''' good for. For example, a naive mistake might be to attempt to display a UIAlertView from your %ctor, which would most likely be impossible (depending on the process you're loading in to) as it has not even bootstrapped yet, so attempting to display UIKit elements at this point is futile.  
  
 
It will probably minimize headache if you keep your %ctor use to just the bare minimum, and rather perform any extraneous setup at a different (most likely later) point.
 
It will probably minimize headache if you keep your %ctor use to just the bare minimum, and rather perform any extraneous setup at a different (most likely later) point.

Revision as of 17:05, 27 January 2015

Let's say you've figured out how to set up Theos, you know enough Objective-C to fool around, you know a little about how to use Cydia Substrate, and basically you've read all the beginner tutorials - what do you read next to learn more about jailbroken development as you experiment with building your own project? We should have a set of "next steps" tutorials for you!

These ones haven't been written yet, but it would be pretty cool for somebody to write them...maybe you? Anyone can start a page and begin writing some explanations, or you can just start filling out the sections below with more information. (Also, if you have an idea for a tutorial that you would like to see, feel free to add it to this list - it might inspire somebody to write an explanation of that thing you want to learn about.)

Using Development Tools

Changing System Volume with AVSystemController and Cycript

  • assumes the reader has basic Cycript and Objective-C knowledge
  • takes the reader on a journey through AVSystemController's methods using cycript
  • documents the thought process (ex. "-getVolume:(float*)arg1 forCategory:(id)arg2 indicates that there are different categories of volumes and they each have their own values")
  • ends with using the information learned to make a really simple command line utility

Dynamic Method Hooking With Cycript

  • assumes the reader has basic Cycript and Objective-C knowledge
  • showcases Cycript's ability to hook methods
  • hook some example methods to display benefits of dynamic hooking

What's %ctor good for?

%ctor is a logos directive which resolves to __atribute_((constructor)), which is a block that runs immediately when your dylib gets loaded.

The syntax is similar to that of a function. An example is shown below:

%ctor {

   //This runs when your tweak gets loaded into the target process
   NSlog(@"My tweak has loaded!");

}

%ctor can be useful for performing any setup, for example, instantiating variables or reading your tweak's preferences.

However, there are certain things which %ctor is not good for. For example, a naive mistake might be to attempt to display a UIAlertView from your %ctor, which would most likely be impossible (depending on the process you're loading in to) as it has not even bootstrapped yet, so attempting to display UIKit elements at this point is futile.

It will probably minimize headache if you keep your %ctor use to just the bare minimum, and rather perform any extraneous setup at a different (most likely later) point.

Dissecting App Store Apps

Integrating with Third Party Frameworks and Libraries

Building Tweak Settings with PreferenceLoader

  • goes through the process of building simple tweak preferences that are shown in Settings
  • shows the correct way to read/write to those settings in your tweak code
  • also shows how to use popular third party additions such as AppList / libcolorpicker / Activator

Your First Flipswitch

  • explains the idea behind the Flipswitch framework
  • goes through the different methods / objects you'll probably be using
  • shows how to build a simple flipswitch (ex. a simple flashlight toggle)

Integrating Your Tweak With Activator

  • goes through the Activator library
  • dos / don't of the Activator API
  • demo a simple Activator event (ex. got a notification from a specific app)
  • demo a simple Activator listener (ex. show an alert)