iPhone Problems, Causes and Solutions
Getting svn to ignore build directory, .mode1v3 and .pbxuser files
Problem
- The build directory should not be checked into source control.
- The 2 xcode user files ending in .mode1v3 and .pbxuser should not be checked into source control.
- The Subversion functionality in Xcode to ignore the directory and files are not clear / available (as of 2009-12-14).
Cause
- Gap in Xcode functionality?
Solution
- Launch terminal, cd to project directory:
computer:MyApp juser$ svn status ? build ? MyApp.xcodeproj/juser.mode1v3 ? MyApp.xcodeproj/juser.pbxuser computer:MyApp juser$ svn propset svn:ignore build . property 'svn:ignore' set on '.' computer:MyApp juser$ svn status M . ? MyApp.xcodeproj/juser.mode1v3 ? MyApp.xcodeproj/juser.pbxuser computer:MyApp juser$ svn propset svn:ignore juser.* ./MyApp.xcodeproj/ property 'svn:ignore' set on 'MyApp.xcodeproj' computer:MyApp juser$ svn status M . M MyApp.xcodeproj computer:MyApp juser$
'Expected specifier-qualifier-list before 'NSManagedObjectModel''
Problem
- Adding CoreData to and existing project, had added framework correctly.
- Possible that this could occur adding other frameworks to existing projects.
- During build or compile the error 'Expected specifier-qualifier-list before 'NSManagedObjectModel'' occurs.
Cause
- Missing reference to CoreData in the *_Prefix.pch file.
Solution
- Add the following to your *_Prefix.pch file
...
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h> // Added to fix 'Expected specifier-qualifier-list' error
#endif
...
'+entityForName: could not locate an NSManagedObjectModel for entity name
Problem
- Adding CoreData to and existing project, had added framework correctly.
- Data model had been created correctly and corresponding Core Data boiler plate code added.
- During access of cellForRowAtIndexPath an error occurs:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Message''
Cause
- The managed object model wasn't loaded or configured properly.
Solution
- Many possible causes.
- One cause is in the FollowUpAppDelegate.m, applicationDidFinishLaunching the rootViewController must have the managedObjectContext set.
...
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Override point for customization after app launch
if(self.rootViewController == nil)
{
RootViewController *rootViewControllerLocal = [[RootViewController alloc] init];
self.rootViewController = rootViewControllerLocal;
self.rootViewController.managedObjectContext = self.managedObjectContext; // Solution, must be set
[rootViewControllerLocal release];
}
...
}
"_CGRectZero"
Problem
"_CGRectZero", referenced from:
_CGRectZero$non_lazy_ptr in MyTableViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Cause
- Missing CoreGraphics Framework in the project.
Solution
- Copy the CoreGraphics Framework into the project.
Code Sign error: a valid provisioning profile matching the application's Identifier
Problem
Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.ProjectName' could not be found
Cause
- Most likely the provisioning profile on the device does not match the profile in the Xcode Organizer.
Solution
- Ensure that there is a valid provisioning profile installed on the device.
- Ensure that the corresponding provisioning profile is installed in the Xcode Organizer.
Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain
Problem
Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain
Cause
- Most likely the provisioning profile on the device has expired.
Solution
- Need to create a new provisioning profile.