Archive for the ‘iPhone’ Category

Few words on cracking iPhone applications

Few days ago I was reading about Craculous being released as an open source application. Since Craculous is an iPhone application cracking tool and I have a few apps in the AppStore I have a few points to make to all those people who are considering using the tool.

I know a few developers who write apps for the AppStore. They aren’t millionaires. Some of them barely make enough money to cover their bills. Others, work second jobs because the income from the AppStore is just not enough to pay for their necessities.

Yes, there are few people who were lucky enough to make good money but, if you think for a second, how many of those have you heard about? 3, 5, 20? And how many apps are in the AppStore? The last number was around 18′000. So who do you think you are stealing from? You may as well go to the poorest part of town you live in, find a woman who is working 2 jobs to support her and two children and then rob her. That’s pretty much an real life equivalent of you cracking an app from the AppStore.

Now that you know how it feels from the other side of the AppStore let me tell you a little bit of what happens when the third party developers can’t make enough money. People like I and my friends have two choices.

First, is just to say “fuck it!” and do something else where we can make some money. The second option is to develop ad supported apps. Both of these options aren’t very good for you.

See, unlike artists (musicians, actors, producers) we developers can do other things. We can work for companies and write business apps for them. We can create subscription web apps for which you will shell out way more money then a simple app on your phone. We can work for big companies Apple, Adobe, Microsoft and create apps that are locked
so tight that you will need a blood sample to authenticate yourself as a user. It’s not the most attractive work but it does pay the bills. We can do that but then you will not get the cool apps on your phone.

Honestly, most of the indy developers would rather create apps for you. Find out what you need and help you out with the solution. All we ask is for you to help us pay our bills.

Now the second option. Adware! Sounds almost like a curse word and it really is. When someone develops adware they are no longer working for you. The are working for the people who peddle their products through the software. You will never have as good experience with adware as with software that is developed for you. You loose the control of what features are added to the program because you aren’t paying for it. This is why most adware software are pieces of garbage.

Take for example the shows you get on TV stations supported by commercials and the ones that are not. Most of the shows on commercials supported channels are designed to sell you stuff. The plot is created to build the suspense up and stop for a commercial break. They will always leave you hanging and show you the stuff they want to sell to you.

On the other hand when you watch shows from stations which do not have to rely on sponsors you will get the whole story. They don’t have to worry about placing the ads and creating the shows with ads in mind. They just want to give YOU the best experience. The best show.

Similar things you will find in software. Either you pay for the best experience there is or you are going to get junk that sells you other junk. Your choice.

The last thing I would like to bring to your attention is the word “honor.” Where is their honor? I realize that some people might have forgotten the word. Others, may be confused by the myriad of definitions.

I am talking about this one:

honor
- noun
“honesty, fairness, or integrity in one’s beliefs and actions”

Is cracking $0.99 app worth giving up your integrity?

Please comment and let me know what you think.

iPhone screenshot processing – part 2

Today I was working on automating of preparation of iPhone screen shots for usage on the website. The new eideticsoftware.com website design requires for the images to have drop shadows so instead processing everything in Adobe® Photoshop® I have decided it would be much nicer to just automate the process with rmagick.

If you are impatient and just want the script jump to the bottom of the post and download image_processor.rb but if you want to know how it works then read on.

This script scales the images for the post.

example_scaled
First we take the original image and scale it by 50% –

source = original.scale(0.5)











example_scaled_stripped
Next we strip out the status bar with crop method:

source = source.crop(0, 10, 160, 240)











example_scaled_stripped_canvas_with_shadow
We create a transparent canvas that is 10px wider and 10px longer and another identical canvas that we are going to use for the shadow. On the image_shadow canvas we draw a rectangle with the same dimensions as the original image. In the source file the rectangle is created by the “drop_shadow_rectangle” function.

We use the image_shadow canvas to create two shadows, first is the actual shadow, the second we use as a mask to soften the shadow itself.

We apply the first shadow to the original canvas with “OverCompositeOp” option and then we apply the mask on top of that with “CopyOpacityCompositeOp” option.


example_scaled_stripped_canvas_with_image
We apply the scaled and cropped image on top of the shadow and draw a white border. The white border is only necessary when the screen shot is dark to distinguish the shadow from the image.

Finally we write the image to a file with “canvas.write” method.







Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require 'rubygems'
require 'rmagick'
 
include Magick
 
img_filename = "example.png"
 
 
# Helper function to create new name
def new_name(img_filename, modifier = "_shadow")
  chunks = img_filename.split(".")
  chunks[0..-2].join(".") + modifier + ".#{chunks[-1]}"  
end
 
# Creates drop show rectangle
def drop_shadow_rectangle(x,y,width,height)
  gc = Draw.new
  gc.fill_color("black")
  gc.rectangle(x,y,width,height)
end
 
# creates frame draw object
def white_frame(x,y,width, height)
  frame = Draw.new
  frame.fill_opacity(0)
  frame.stroke_color("white")
  frame.rectangle(x,y,width,height)
end
 
 
def add_shadow(img_filename)  
  original = ImageList.new(img_filename)
 
  source = original.scale(0.5)
  source.write(new_name(source.filename, "_scaled"))
  source = source.crop(0, 10, 160, 240)
 
  canvas = Image.new(source.columns + 10, source.rows + 10) do
    self.background_color = "transparent"
  end
 
  # Generates intermediate images
  #source.write(new_name(source.filename, "_stripped"))
  #canvas.write(new_name(source.filename, "_raw_canvas"))
 
  image_shadow = Image.new(canvas.columns, canvas.rows) do
    self.background_color = "transparent"
  end
 
  drop_shadow_rectangle(0, 0, source.columns, source.rows).draw(image_shadow)
 
  blur = 1
  x, y = 1, 1
 
  image_shadow = image_shadow.shadow(x, y, blur, 1)
  shadow_mask = image_shadow.shadow(x, y, blur, 1)
 
  # Place the shadow
  canvas.composite!(image_shadow, 0, 0, OverCompositeOp)
 
  # Place the mask to soften the shadow
  canvas.composite!(shadow_mask, 0, 0, CopyOpacityCompositeOp)
 
  # Intermediate image  
  # canvas.write(new_name(source.filename, "_canvas_with_shadow"))
 
  # Now place the image on the canvas
  canvas.composite!(source, 1, 1, OverCompositeOp)
 
  # And draw the white border on top of the image
  white_frame(0, 0, source.columns, source.rows).draw canvas
 
  # save the final image
  canvas.write(new_name(source.filename, "_canvas_with_image"))
end
 
add_shadow(img_filename)

Processor: image_processor.rb

Automating iPhone screenshots processing with rmagick

In programming repetition is evil. No one should do the same task more than once so I was not to excited about doing screenshots for FitTimer.

Taking the screenshots is not a big deal.

  1. On your device Hold the sleep/wake button and click the “home” button.
  2. Connect the device to your mac and import your images to iPhoto
  3. Select the imported images in iPhoto and drag them to a desired folder.

Unfortunately you can’t use these raw images. Apple requires you convert them to JPEG format and recommends you crop out the iPhone status bar. This task for many people mean opening each screenshot in Photoshop, cropping the image to “320 x 460″ and saving it as a JPG.

One may say: “It’s only a few images” but if you often update to your applications UI updating screenshots becomes one more thing you have to do. Additionally, if your website requires screenshots of different size or thumbnails, your screenshot updating task will take more and more time.

There is a better way of dealing with screenshots. You can automate the whole process with a few simple lines of ruby code using rmagick gem.

To use rmagick you will need to install the gem. You can find a link to installation instructions at the end of the post in the references section.

After you have rmagick successfully installed you can start processing your images.

I keep all my marketing material in <project_root>/marketing folder to keep it together in a single source code repository (git), however you are welcome to keep it anywhere you like.

To use my script you will need to prepare a few things:

  1. Create your working folder (in my project – “marketing”)
  2. In the working folder create three folders “raw_images”, “itunesconnect” and “web_images”
  3. Copy the script to the working folder
  4. Copy your raw ‘png’ screenshots to raw_images
  5. If you are copying the files from iPhoto you may want to rename them to something human readable like “main_view.png”
  6. Open your favorite terminal app and run the script

The script does 4 things.

  1. Crops the status bar and saves screenshots for itunesconnect in the itunesconnect folder
  2. Saves the cropped screenshots in the web_images folder
  3. Reduces the image by 50% and saves it in web_images folder with new name <filename>_50.jpg
  4. Creates a thumbnail by reducing the original image to 25% of it’s original size and saves it in web_images folder with new name following schema <filename>_thumb.jpg
require 'rubygems'
require 'rmagick'
 
Dir.glob('raw_images/*').each do |original|
  path = original.split('/')
  name = path[1].split('.').first
 
  itunes_img_path = "itunesconnect/#{name}.jpg"
 
  web_img_path = "web_images/#{name}.jpg"
  web_img_scaled_path = "web_images/#{name}_50.jpg"
  web_img_thumb_path = "web_images/#{name}_thumb.jpg"
 
  original = Magick::ImageList.new(original)
  cropped = original.crop(0,20, 320, 460)
  cropped.write(itunes_img_path)
  cropped.write(web_img_path)
 
  scaled = cropped.scale(0.5)
  scaled.write(web_img_scaled_path)
 
  thumb = cropped.scale(0.25)
  scaled.write(web_img_thumb_path)
end

References

Rmagick installation instructions
iTunes Connect Developer Guide can be found on the itunesconnect website in Manage Your Applications Section.

iPhone SDK 2.2 – CodeSign Error

My weekend work plans were simple.

  1. Update iphone sdk to 2.2
  2. Write some more functionality for my FitTimer app.

Unfortunately the second part of my plan was never started because updating the SDK took most of my Saturday and Sunday.

The official update was not very difficult but after I have installed SDK 2.2 and updated my test devices I no longer was able to install my apps. I have gotten this nasty CodeSign error:

"CodeSign error: a valid provisioning profile is required for product
type 'Application' in SDK 'Device - iPhone OS 2.2"

I have done everything from adjusting project settings to regenerating certificates and provisioning profiles. I have not gotten much traction with any of my efforts. The solution came after I have found a post claiming there is a bug in SDK2.2 that causes for the project files to get corrupted.

So I have pulled out my trusty (MacVim) editor and opened up the: ProjectName.xcodeproj/project.pbxproj file and started snooping around.

I have found that I had multiple Build Configuration sections and my

"PROVISIONING_PROFILE[sdk=iphoneos*]" =
   "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

entry had a different number then my installed provisioning profiles.

So here are the steps to get it working again:

  1. SAVE YOUR WORK JUST IN CASE THIS SOLUTION DOES NOT WORK FOR YOUR PROBLEM
  2. Save your old project file.
  3. Go to ~/Library/MobileDevices/Provisioning Profiles
  4. Figure out which profile is the one relating to your project. Sometimes the profiles are saved with UUID as the file name so you may have to run grep with your project’s name to figure out which one it is.
  5. $ grep myAppName *
    Binary file xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision matches
    
  6. Copy the xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx number.
  7. Save your current work and close XCode
  8. Go to yourProjectDirectory/ProjectName.xcodeproj/ and using a text editor (MacVim for me) open the project.pbxproj file
  9. Find all "PROVISIONING_PROFILE[sdk=iphoneos*]" entries and replace the assignment value with the number you have copied in step 4.
  10. Save the project.pbxproj file
  11. Reopen Xcode and recompile your projects. The CodeSign error should be gone.

I hope this helps and saves you a lot of time.

Good luck and if you have some time please check out my app: FitTimer

Updated: [important]
Please read Big3’s post https://devforums.apple.com/message/15497 and file bug report with apple. Send them your saved project file so they can figure out why XCode projects are getting corrupted.

FitTimer – staying fit and having time for other things.

I like working out, but I like a lot of things and working out usually does not make my priority list as much these days. I used to spend a lot of time in a gym. By “a lot of time” I really mean a lot of time. Some weeks I must have spend as many as 20 hours in the gym. I was really fit but I had absolutely no time for other things.

I have started to wonder why my workouts are taking so much of my time. What in those workouts take the time and if there is a way to workout as hard but in less time. I bought a stopwatch and started measuring where the time was going. As you may expect it was not going into working out. Most of my time was spent on breaks. Breaks could take up as much as 90% of my time in the gym.

90% seems like a lot of time, so I have stated to experiment with different break times and I have noticed that I did not need to take such long breaks.  For most exercises a 45 second break was adequate where others were ok at 60 seconds.  Needless to say stopwatch became a necessary accessory at the gym.  Yes one more thing to carry while I work out.

And then … Apple came out with the iPhone.  Thanks, Apple.  It is the device that has replaced 3 items I used to carry with me at the gym.  The phone, an iPod and the stopwatch.

I have written FitTimer to be the way to keep track of my breaks.  Simplicity and nice design where the top priorities during the design process.

It had to be simpler then a stopwatch. After all no one want’s to struggle with a program while they are working out.  Your focus should be always on working out and not on operating a device.  Tracking your workout should be almost incidental and not the primary goal of working out.

It had to look good.  As one of the “gym rats” I know full well that we are somewhat vain.  OK, some of us are really vain, but I am talking about the average “gym rat.”  We go to the gym to look good.  Why would we have an app in the gym that makes us look worse?  Well, we would not.

So here is what I came up with:

Simple, functional and elegant.

Now I can fit my workouts in under an hour.  That’s 2 hours I save every day.

I bet if you work out and not measuring your times you are wasting your time just I use to so if you have an iPhone or an iPod touch you can get the app at the apple AppStore: FitTimer

You can also see more screen shot on our company website: http://www.eideticsoftware.com/fittimer