From ef19a19f9ae8fd5350265269e58ae708644cd864 Mon Sep 17 00:00:00 2001 From: Ortwin Gentz Date: Mon, 1 Oct 2012 10:49:32 +0200 Subject: [PATCH] Added Info.plist viewer for IPAs --- Classes/IPAArchive.h | 1 + Classes/IPAArchive.m | 14 + Classes/IPAViewController.m | 20 +- Classes/PlistViewController.h | 14 + Classes/PlistViewController.m | 20 ++ Classes/PlistViewController.xib | 268 ++++++++++++++++++ .../project.pbxproj | 14 +- 7 files changed, 347 insertions(+), 4 deletions(-) create mode 100644 Classes/PlistViewController.h create mode 100644 Classes/PlistViewController.m create mode 100644 Classes/PlistViewController.xib diff --git a/Classes/IPAArchive.h b/Classes/IPAArchive.h index d141be9..3d1ccbb 100644 --- a/Classes/IPAArchive.h +++ b/Classes/IPAArchive.h @@ -16,6 +16,7 @@ @property (nonatomic, readonly, retain) NSString *appName; @property (nonatomic, readonly, retain) UIImage *appIcon; @property (nonatomic, readonly, retain) NSArray *imageNames; +@property (nonatomic, retain) NSString *infoPlistString; @property (nonatomic, readonly) BOOL iPhone; @property (nonatomic, readonly) BOOL iPad; diff --git a/Classes/IPAArchive.m b/Classes/IPAArchive.m index eea0cab..90e67bf 100644 --- a/Classes/IPAArchive.m +++ b/Classes/IPAArchive.m @@ -104,6 +104,20 @@ - (NSDictionary *) infoPlist return _infoPlist; } +- (NSString *) infoPlistString +{ + if (_infoPlistString) + return _infoPlistString; + + NSString *error; + NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:self.infoPlist + format:NSPropertyListXMLFormat_v1_0 + errorDescription:&error]; + + _infoPlistString = [[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding]; + return _infoPlistString; +} + - (NSString *) appName { return [self.metadata objectForKey:@"itemName"]; diff --git a/Classes/IPAViewController.m b/Classes/IPAViewController.m index d323df8..77982e3 100644 --- a/Classes/IPAViewController.m +++ b/Classes/IPAViewController.m @@ -10,6 +10,7 @@ #import "AppDelegate.h" #import "ArtworkViewController.h" +#import "PlistViewController.h" #import "IPAArchive.h" #import "NSString+IPAArchive.h" @@ -98,9 +99,10 @@ - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSIntege - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IPACell"]; - if (!cell) + if (!cell) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IPACell"] autorelease]; - + cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; + } return cell; } @@ -130,6 +132,20 @@ - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath [self.navigationController pushViewController:artworkViewController animated:YES]; } +- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { + NSMutableArray *archives = [self archivesForTableView:tableView]; + IPAArchive *archive = [archives objectAtIndex:indexPath.row]; + if (![archive isKindOfClass:[IPAArchive class]]) + { + NSString *path = (NSString *)archive; + archive = [[[IPAArchive alloc] initWithPath:path] autorelease]; + [archives replaceObjectAtIndex:indexPath.row withObject:archive]; + } + PlistViewController *pListViewController = [[[PlistViewController alloc] init] autorelease]; + pListViewController.plistString = archive.infoPlistString; + [self.navigationController pushViewController:pListViewController animated:YES]; +} + // MARK: - Search Display Delegate - (void) searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView diff --git a/Classes/PlistViewController.h b/Classes/PlistViewController.h new file mode 100644 index 0000000..7bcfdd4 --- /dev/null +++ b/Classes/PlistViewController.h @@ -0,0 +1,14 @@ +// +// PlistViewController.h +// UIKit Artwork Extractor +// +// Created by Ortwin Gentz on 01.10.12. +// Copyright (c) 2012 Cédric Luthi. All rights reserved. +// + +#import + +@interface PlistViewController : UIViewController +@property (nonatomic, retain) NSString *plistString; +@property (nonatomic, retain) IBOutlet UITextView *plistTextView; +@end diff --git a/Classes/PlistViewController.m b/Classes/PlistViewController.m new file mode 100644 index 0000000..07ef98a --- /dev/null +++ b/Classes/PlistViewController.m @@ -0,0 +1,20 @@ +// +// PlistViewController.m +// UIKit Artwork Extractor +// +// Created by Ortwin Gentz on 01.10.12. +// Copyright (c) 2012 Cédric Luthi. All rights reserved. +// + +#import "PlistViewController.h" + +@interface PlistViewController () + +@end + +@implementation PlistViewController + +- (void)viewWillAppear:(BOOL)animated { + self.plistTextView.text = self.plistString; +} +@end diff --git a/Classes/PlistViewController.xib b/Classes/PlistViewController.xib new file mode 100644 index 0000000..4477b00 --- /dev/null +++ b/Classes/PlistViewController.xib @@ -0,0 +1,268 @@ + + + + 1536 + 11G56 + 2840 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1926 + + + IBNSLayoutConstraint + IBProxyObject + IBUITextView + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 274 + {320, 548} + + _NS:9 + + 1 + MSAxIDEAA + + YES + YES + IBCocoaTouchFramework + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + 2 + IBCocoaTouchFramework + + + 1 + 14 + + + Helvetica + 14 + 16 + + + + {{0, 20}, {320, 548}} + + + 3 + MQA + + 2 + + + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + plistTextView + + + + 9 + + + + + + 0 + + + + + + 1 + + + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + PlistViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 9 + + + 0 + IBCocoaTouchFramework + YES + 3 + YES + 1926 + + diff --git a/iOS Artwork Extractor.xcodeproj/project.pbxproj b/iOS Artwork Extractor.xcodeproj/project.pbxproj index abd6892..8076a4c 100644 --- a/iOS Artwork Extractor.xcodeproj/project.pbxproj +++ b/iOS Artwork Extractor.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 28216C970DB411BC00E5133A /* ArtworkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28216C960DB411BC00E5133A /* ArtworkViewController.m */; }; 288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765070DF74369002DB57D /* CoreGraphics.framework */; }; 28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; }; + AA452B2116198C0F00E17C53 /* PlistViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AA452B1F16198C0F00E17C53 /* PlistViewController.m */; }; + AA452B2216198C0F00E17C53 /* PlistViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AA452B2016198C0F00E17C53 /* PlistViewController.xib */; }; C226CB891771BE9900908EF0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C226CB881771BE9900908EF0 /* Default-568h@2x.png */; }; DA3A6AFF120A9C8E00915B15 /* Checkerboard.png in Resources */ = {isa = PBXBuildFile; fileRef = DA3A6AFE120A9C8E00915B15 /* Checkerboard.png */; }; DA3C70FA1141405200A99F39 /* ArtworkDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3C70F91141405200A99F39 /* ArtworkDetailViewController.m */; }; @@ -75,6 +77,9 @@ 28AD73870D9D96C1002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainWindow.xib; path = ../MainWindow.xib; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* iOS_Artwork_Extractor-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iOS_Artwork_Extractor-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + AA452B1E16198C0F00E17C53 /* PlistViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlistViewController.h; sourceTree = ""; }; + AA452B1F16198C0F00E17C53 /* PlistViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlistViewController.m; sourceTree = ""; }; + AA452B2016198C0F00E17C53 /* PlistViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlistViewController.xib; sourceTree = ""; }; C226CB881771BE9900908EF0 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; DA3A6AFE120A9C8E00915B15 /* Checkerboard.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Checkerboard.png; path = Resources/Checkerboard.png; sourceTree = ""; }; DA3C70F81141405200A99F39 /* ArtworkDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArtworkDetailViewController.h; sourceTree = ""; }; @@ -188,6 +193,9 @@ DAB5332F14B3C38400EDDE37 /* IPAViewController.h */, DAB5333014B3C38400EDDE37 /* IPAViewController.m */, DAB5337C14B3C67500EDDE37 /* IPAViewController.xib */, + AA452B1E16198C0F00E17C53 /* PlistViewController.h */, + AA452B1F16198C0F00E17C53 /* PlistViewController.m */, + AA452B2016198C0F00E17C53 /* PlistViewController.xib */, ); path = Classes; sourceTree = ""; @@ -402,6 +410,7 @@ DAB5337B14B3C65500EDDE37 /* IPA@2x.png in Resources */, DAB5337D14B3C67500EDDE37 /* IPAViewController.xib in Resources */, C226CB891771BE9900908EF0 /* Default-568h@2x.png in Resources */, + AA452B2216198C0F00E17C53 /* PlistViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -440,6 +449,7 @@ DAB5337114B3C39D00EDDE37 /* ZKLog.m in Sources */, DAD7253F14BB9A80001ED756 /* NSString+IPAArchive.m in Sources */, DAFFB59C150A5CF400A4B6DC /* EmojiImageView.m in Sources */, + AA452B2116198C0F00E17C53 /* PlistViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -482,7 +492,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; SDKROOT = iphoneos; }; name = Debug; @@ -495,7 +505,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; SDKROOT = iphoneos; }; name = Release;