Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Updated to iOS 5 project settings and fixed memory leaks. #4

Closed
wants to merge 3 commits into from

2 participants

@endoze

Updated project settings to iOS 5 settings. Also added a release in ABContact to clean up memory after we are done with our reference to the addressBook. Added ivars/properties for window and nav to the app delegate and cleaned up memory of temporary objects in applicationDidFinishLaunching so we don't leak memory.

endoze added some commits
@endoze endoze Updated project settings to iOS 5 settings. Also added a release in A…
…BContact to clean up memory after we are done with our reference to the addressBook. Added ivars/properties for window and nav to the app delegate and cleaned up memory of temporary objects in applicationDidFinishLaunching so we don't leak memory.
44dfdb9
@endoze endoze Added ability to search for contacts with a given organization 79051a2
@endoze endoze Add test for searching by organization 2b1c14b
@erica erica closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 8, 2012
  1. @endoze

    Updated project settings to iOS 5 settings. Also added a release in A…

    endoze authored
    …BContact to clean up memory after we are done with our reference to the addressBook. Added ivars/properties for window and nav to the app delegate and cleaned up memory of temporary objects in applicationDidFinishLaunching so we don't leak memory.
Commits on Jun 12, 2012
  1. @endoze
Commits on Jul 30, 2012
  1. @endoze
This page is out of date. Refresh to see the latest.
View
BIN  .DS_Store
Binary file not shown
View
1  ABContact.m
@@ -64,6 +64,7 @@ + (id) contactWithRecordID: (ABRecordID) recordID
ABRecordRef contactrec = ABAddressBookGetPersonWithRecordID(addressBook, recordID);
ABContact *contact = [self contactWithRecord:contactrec];
// CFRelease(contactrec); // Thanks Gary Fung
+ CFRelease(addressBook);
return contact;
}
View
1  ABContactsHelper.h
@@ -36,6 +36,7 @@
+ (NSArray *) contactsMatchingName: (NSString *) fname;
+ (NSArray *) contactsMatchingName: (NSString *) fname andName: (NSString *) lname;
+ (NSArray *) contactsMatchingPhone: (NSString *) number;
++ (NSArray *) contactsMatchingOrganization: (NSString *) organization;
// Find groups
+ (NSArray *) groupsMatchingName: (NSString *) fname;
View
8 ABContactsHelper.m
@@ -117,6 +117,14 @@ + (NSArray *) contactsMatchingName: (NSString *) fname andName: (NSString *) lna
return contacts;
}
++ (NSArray *) contactsMatchingOrganization: (NSString *) organization
+{
+ NSPredicate *pred;
+ NSArray *contacts = [ABContactsHelper contacts];
+ pred = [NSPredicate predicateWithFormat:@"organization contains[cd] %@", organization];
+ return [contacts filteredArrayUsingPredicate:pred];
+}
+
+ (NSArray *) contactsMatchingPhone: (NSString *) number
{
NSPredicate *pred;
View
39 HelloWorld.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 45;
+ objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@@ -135,9 +135,16 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0430;
+ };
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ en,
+ );
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
@@ -179,21 +186,17 @@
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Erica Sadun";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/../Work/SDKStuff/99BOOK/C09 - PeoplePlacesThings/01a - Finding People/iphoneos2.0/System/Library/Frameworks\"",
- );
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
INFOPLIST_FILE = Info.plist;
- PREBINDING = NO;
PRODUCT_NAME = HelloWorld;
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
};
name = Debug;
};
@@ -202,15 +205,10 @@
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/../Work/SDKStuff/99BOOK/C09 - PeoplePlacesThings/01a - Finding People/iphoneos2.0/System/Library/Frameworks\"",
- );
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
INFOPLIST_FILE = Info.plist;
- PREBINDING = NO;
PRODUCT_NAME = HelloWorld;
WRAPPER_EXTENSION = app;
};
@@ -221,15 +219,15 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CODE_SIGN_IDENTITY = "Erica Sadun";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
PRODUCT_NAME = "Oh Hello";
- SDKROOT = iphoneos2.0;
+ PROVISIONING_PROFILE = "";
+ SDKROOT = iphoneos;
};
name = Debug;
};
@@ -237,8 +235,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- PREBINDING = NO;
- SDKROOT = iphoneos2.0;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ PROVISIONING_PROFILE = "";
+ SDKROOT = iphoneos;
};
name = Release;
};
View
7 HelloWorld.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:HelloWorld.xcodeproj">
+ </FileRef>
+</Workspace>
View
BIN  HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/Endoze.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
10 HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/Endoze.xcuserdatad/WorkspaceSettings.xcsettings
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
+ <true/>
+ <key>SnapshotAutomaticallyBeforeSignificantChanges</key>
+ <true/>
+</dict>
+</plist>
View
85 HelloWorld.xcodeproj/xcuserdata/Endoze.xcuserdatad/xcschemes/HelloWorld.xcscheme
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+ BuildableName = "HelloWorld.app"
+ BlueprintName = "HelloWorld"
+ ReferencedContainer = "container:HelloWorld.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+ BuildableName = "HelloWorld.app"
+ BlueprintName = "HelloWorld"
+ ReferencedContainer = "container:HelloWorld.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+ BuildableName = "HelloWorld.app"
+ BlueprintName = "HelloWorld"
+ ReferencedContainer = "container:HelloWorld.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+ BuildableName = "HelloWorld.app"
+ BlueprintName = "HelloWorld"
+ ReferencedContainer = "container:HelloWorld.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
22 HelloWorld.xcodeproj/xcuserdata/Endoze.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>HelloWorld.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>1D6058900D05DD3D006BFB54</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
35 main.m
@@ -36,7 +36,8 @@ - (void) doLog: (NSString *) formatstring, ...
- (void) addGW
{
// Search for a contact, creating a new one if one is not found
- NSArray *contacts = [ABContactsHelper contactsMatchingName:@"Washington" andName:@"George"];
+// NSArray *contacts = [ABContactsHelper contactsMatchingName:@"Washington" andName:@"George"];
+ NSArray *contacts = [ABContactsHelper contactsMatchingOrganization:@"FAKE ORG"];
printf("%d matching contacts found\n", contacts.count);
ABContact *peep = contacts.count ? [contacts lastObject] : [ABContact contact];
@@ -60,6 +61,7 @@ - (void) addGW
peep.firstnamephonetic = @"Horhay";
peep.lastnamephonetic = @"Warsh-ing-town";
peep.jobtitle = @"President of the United States of America";
+ peep.organization = @"FAKE ORG";
// Emails
NSMutableArray *emailarray = [NSMutableArray array];
@@ -204,27 +206,42 @@ - (void) viewDidLoad
self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
// BASIC TEST
- // self.navigationItem.rightBarButtonItem = BARBUTTON(@"Add GW", @selector(addGW));
- // self.navigationItem.leftBarButtonItem = BARBUTTON(@"Scan", @selector(scan));
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Add GW", @selector(addGW));
+ self.navigationItem.leftBarButtonItem = BARBUTTON(@"Scan", @selector(scan));
// GROUPS TEST
- // self.navigationItem.rightBarButtonItem = BARBUTTON(@"Groups", @selector(viewgroups));
- // self.navigationItem.leftBarButtonItem = BARBUTTON(@"Add", @selector(addGroup));
+// self.navigationItem.rightBarButtonItem = BARBUTTON(@"Groups", @selector(viewgroups));
+// self.navigationItem.leftBarButtonItem = BARBUTTON(@"Add", @selector(addGroup));
// SERIALIZATION TEST
- self.navigationItem.rightBarButtonItem = BARBUTTON(@"Serialize", @selector(serialize));
+// self.navigationItem.rightBarButtonItem = BARBUTTON(@"Serialize", @selector(serialize));
}
@end
@interface TestBedAppDelegate : NSObject <UIApplicationDelegate>
+{
+ UIWindow *_window;
+ UINavigationController *_nav;
+}
+@property (nonatomic, retain) UINavigationController *nav;
+@property (nonatomic, retain) UIWindow *window;
@end
@implementation TestBedAppDelegate
+@synthesize nav = _nav;
+@synthesize window = _window;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[TestBedViewController alloc] init]];
- [window addSubview:nav.view];
- [window makeKeyAndVisible];
+ self.window = window;
+ TestBedViewController *testBedViewController = [[TestBedViewController alloc] init];
+ UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:testBedViewController];
+ self.nav = nav;
+ [self.window addSubview:self.nav.view];
+ [self.window makeKeyAndVisible];
+ // clean up memory
+ [nav release];
+ [window release];
+ [testBedViewController release];
}
@end
Something went wrong with that request. Please try again.