Skip to content

How to Extract the Images From Any App in the App Store

Originally posted on Objective C#:

Facebook

Recently I discovered how incredibly easy it to extract the original, full-resolution images (and other resource files like video, audio, .plist files) from any app in the App Store, without jailbreaking, and without special software. For iOS developers, this can give a fascinating look at the insides of an app. As always, be sure to do this for learning purposes only and respect all apps’ intellectual property.

View original 214 more words

The Fallacy Of Android-First

Featured Image -- 1387

Krishnan:

The cost of Fragmentation is so high when compared to iOS and this will lead to user frustration and brand name gets tarnished

Originally posted on TechCrunch:

Editor’s note:Dave Feldman is the co-founder of Emu. Previously he was Entrepreneur in Residence for CrunchFund, led the 2011 redesign of TechCrunch, and managed the design team for Yahoo! Messenger. Emu for iPhone is available now.

In late 2012, we decided to launch Emu on Android first. It went against the conventional wisdom at the time, but we saw a real advantage. Sixteen months later, we’re back on iOS: Emu for iPhone launched on April 2. Here’s why Android didn’t work out for us and why you should think carefully before going Android-first.

To build a messaging app on iPhone, you have to create your own communication channel — essentially an IM service. But on Android, you can simply replace the built-in Messages app, while still using the underlying SMS/MMS medium. You save yourself the effort of building a communication service. And, your users needn’t invite their friends:…

View original 2,004 more words

Sharing the iOS SDK, Xcode installers with other people

Each time a new version of iOS SDK , Xcode is available for update, we have to download a .dmg  file with size of 2.0+ GB and lot of time to get the update. So when many people want to share the dmg, instead of downloading the dmg from the appstore, it is better to download it once and share it with others.

The link where you get all these installers is:

https://developer.apple.com/downloads/index.action?q=xcode#

 

Thanks:

http://apple.stackexchange.com/questions/104520/from-where-to-download-xcode-5

Core data Fetch Request returning wrong number of records

I  am using Core data’s NSFetchRequest to extract all distinct values of a column from a Table. Sometimes I would need to extract all the items without any NSPredicate  and sometimes with the predicate.

So I started getting two weird problems when I  used the below code:

NSEntityDescription *entity = [NSEntityDescription  entityForName:@"EntityName" inManagedObjectContext:coreDataContext];

NSFetchRequest *request = [[NSFetchRequest alloc]init];

[request setEntity:entity];

[request setPredicate:predicate];

[request setResultType:NSDictionaryResultType];

[request setReturnsDistinctResults:YES];

[request setPropertiesToFetch:[NSArray arrayWithObject:propertyName] ];

// Execute the fetch.

NSError *error;

NSArray *objects = [coreDataContext executeFetchRequest:request error:&error];

The expected Result:

An array of the NSDictionary-ies with key being the name of the property which we are searching for and the value being the unique value of the property.

Problems I faced:

1. There was an extra record appearing in the result array with an empty key and a value. All other records will had the unique values . (This occurred when I use a single property condition check in NSPredicate)

2. The result always had only 1 record irrespective of the number of unique values.

I used the sqlite queries to check if what I am doing is correct.


SELECT DISTINCT ZPROPERTYNAME FROM ZENTITY  WHERE ZCONPROP1 ==  2 AND ZCONPROP2='aValue'

I verified that whatever I was doing was correct.

Then I tried altering the values of NSPredicate string. Thats where the root cause was.

valid NSPredicate:

NSPredicate *predicate  =  [NSPredicate predicateWithFormat:@”prop1==%d AND prop2==%@”,value1,value2];

Invalid NSPredicate:

NSPredicate *predicate  =  [NSPredicate predicateWithFormat:@”prop1 == %d AND prop2 ==  %@”,value1,value2];

Not much difference between the two predicates right? Yes, except the spaces between property name and == operator and the value.

the device does not support this instrument

While testing for leaks in iOS device, I received this error.

the device does not support this instrument.

The problem I had was, I have not chosen the Provisioning Profile at all in the Xcode for this device. After selecting an appropriate profile, the problem did not occur.

Convert a xml file to plist

You can do it in two steps:

1. Convert xml to json. (use an online tool to do it. I used http://www.utilities-online.info/xmltojson/)

2. Go in to the target folder location( where your have the  json file to be converted)  in terminal.Use plutil to convert json to plist.

plutil -convert xml1 blahblah.json -o blahblah.plist

Using blocks for different modes of TableView

Design Scenario

We have a single Home screen displaying information (in a UITableView)based on user’s preferences.   Lets say there are three modes the home screen can be accessed with.  Now based on each mode,  different information is displayed in cells with the layout of the UITableViewCell itself being  different on each mode. The approaches I have taken to solve this problem are

Option  1:

Use different UIViewController for different mode. This is a simple solution and does not create any further problem in terms of performance. (if  the readers find any problem with this approach please comment it. I will update the post after evaluating it)

Option 2: (The  solution which makes you think it is easy to do)

Use UIViewController’s itself the datasource and delegate of  UITableView to display different information  based on different mode by using Different UITableViewCells (obviously different layout)

Now the problem here is if there are (1+n) different modes , then this approach is a very bad approach because each time you compare in delegate and data source methods what mode the controller is which will affect the usability at least by a negligible amount.

Option 3:

In UIViewController’s viewDidLoad method, determine the mode of the application  and create a separate model controller (derived from NSObject and complying to UITableViewDataSource and/or UITableViewDelegate based on your requirements) for each mode set them as appropriate dataSource and delegate of the UITableView in your view controller.

Verdict:

Option 1 and Option 3 are better solution than Option 2 interms of performance.

Block based solution:

With blocks introduced in iOS 4.0 (nearly three years ago), our approach to solving the above problems can be made much better.

Additional Solution with Blocks:

(Assumption that we have only one section in UITableView)

Block based Solution  for Problem 1:

typedef   NSInteger (^NumberOfRowsInSection)(NSInteger section);

typedef id (^CellCreationForDifferentModes)(UITableView *tableView , NSIndexPath * indexPath);

@interface SPDifferntTypesController ()

{

NumberOfRowsInSection  numberOfRows;

CellCreationForDifferentModes cellcreation;

}

- (void)viewDidLoad

{

if (self.type == SPType1) {

__block SPDifferntTypesController *blocksafeSelf = self;

numberOfRows = ^()

{

return 10;

};

cellcreation =  ^id(UITableView *tableView , NSIndexPath * indexPath)  {

//Create cell and return it

//Type 1 cell

};

}else

{

__block SPDifferntTypesController *blocksafeSelf = self;

numberOfRows = ^()

{

return 5;

};

cellcreation =  ^id(UITableView *tableView , NSIndexPath * indexPath)  {

//Create cell and return it

//Type 2 cell

};

}

}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

return numberOfRows(section);

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

return  cellcreation(tableView,indexPath);

}

Mark files to be not committed to SVN

There are situations where we need to unadd or unmark a file we planned to add to SVN.

We can use svn revert command to do this.

If a single file needs to be unmarked use

$ svn revert filename.h

If a whole directory needs to be marked for ignoring a previous add command use

$ svn revert --depth=infinity .

Undefined symbols for architecture i386:

This problem can occur under the following cases:

1. You forgot to include some Frameworks or static libraries in “Link Binary With Libraries” section of build phases tab.

2. You fail to include the .m files in Compile Sources section of build phases either in your Application project or in your own static library.

3.Build Active Architecture only setting is wrong are multiple values.

4. Using -all_load and  -force_load  sometimes causes this. I have not found the reason.

Image

Notes:

Build phases is a tab in your project’s target.

Repository management of iOS Projects

Some common things to note when using Repository for iOS,Mac projects:

  1. When working as a team , avoid conflict  in .xcodeproj by limiting edits to the project to one team member at a time. If still conflict occurs the only efficient way to resolve is to revert the changes and merge the changes manually.
  2. Ignore the below items from repository
    • .DS_Store
    • *.swp
    • *~.nib
    • build/
    • *.pbxuser
    • *.perspective
    • *.perspectivev3
    • *.project.xcworkspace
    • *.xcuserdata
    • *.mode1v3
    • *.mode2v3
  3. When you use SVN, ignore .git files and when you use GIT ignore .svn files
  4. Always ensure you do not ignore the *.a files until and otherwise you explicitly require it to be ignored

Reference:

http://stackoverflow.com/questions/5343485/what-files-should-svn-ignore-when-doing-iphone-development

http://stackoverflow.com/questions/5931788/iphone-dev-how-important-is-project-pbxproj

Follow

Get every new post delivered to your Inbox.