iOS orientation animation does not happen smoothly

If you apply any changes to the layer of underlying view.

for example,

shadowImageView.layer.masksToBounds = NO;
shadowImageView.layer.shadowOffset = CGSizeMake(-5, 0);
shadowImageView.layer.shadowOpacity = 1.0;

Advertisements

iOS custom UDID

https://github.com/ylechelle/OpenUDID

UIImagePickerController is shifted by ~20px

Subclass UIImagePickerController and override

- (BOOL)  shouldAutorotate
{
return NO;
}

CoreData: error: (19) PRIMARY KEY must be unique

Set the Z_MAX to largest Z_PK value in the corresponding table.

UPDATE "main"."Z_PRIMARYKEY" SET "Z_MAX" = n where "Z_ENT" = n

Cited from: why is this code raising the coredata error 19 primary key must be unique

Add image to custom photo album

– (void) addAssetWithURL:(NSURL *) assetURL toPhotoAlbum:(NSString *) album
{
__block ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

[library assetForURL:assetURL
resultBlock:^(ALAsset *asset)
{
NSString *groupName = [[NSUserDefaults standardUserDefaults] objectForKey:@”groupURL”];
NSURL *groupURL = [[NSURL alloc] initWithString:groupName?groupName:@””];

[library groupForURL:groupURL
resultBlock:^(ALAssetsGroup *group)
{
NSString *groupName = [group valueForProperty:ALAssetsGroupPropertyName];

if ([album isEqualToString:groupName])
{
[group addAsset:asset];
}
else
{
__weak ALAssetsLibrary *lib = library;

[library addAssetsGroupAlbumWithName:album resultBlock:^(ALAssetsGroup *group)
{
NSString *groupName = [group valueForProperty:ALAssetsGroupPropertyName];
NSURL *groupURL = [group valueForProperty:ALAssetsGroupPropertyURL];
[[NSUserDefaults standardUserDefaults] setObject:groupURL.absoluteString forKey:@”groupURL”];

[lib enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:^(ALAssetsGroup *group, BOOL *stop)
{
if ([album isEqualToString:groupName])
{
[group addAsset:asset];
}

} failureBlock:^(NSError *error)
{
}];

} failureBlock:^(NSError *error)
{
}];
}

} failureBlock:^(NSError *error)
{
}];

} failureBlock:^(NSError *error)
{
}];
}

– (void) addToPhotoAlbum:(NSString *) album sourceType:(UIImagePickerControllerSourceType) sourceType assetURL:(NSURL *) assetURL
{
if (sourceType == UIImagePickerControllerSourceTypePhotoLibrary)
{
[self addAssetWithURL:assetURL toPhotoAlbum:kAlbumName];
}
else
{
__block ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

[library writeImageToSavedPhotosAlbum:self.CGImage
orientation:(ALAssetOrientation)self.imageOrientation
completionBlock:^(NSURL *assetURL, NSError *error)
{
[self addAssetWithURL:assetURL toPhotoAlbum:album];
}];
}
}

App Store upload failure – armv6

XCode 4.5 and above won’t support armv6 architecture.

XCode 4.2 – You can create build that supports armv6 architecture, but you have to do the steps mentioned in the following forum.

http://stackoverflow.com/questions/4198676/warning-iphone-apps-should-include-an-armv6-architecture-even-with-build-config

iPhone 5 won’t support armv6 and has new architecture armv7s.

Apple server also has some issue some times https://discussions.apple.com/thread/3822193?start=0&tstart=0

Three20 Framework compile time issues with Xcode 4

Do the following to fix the Three20 framework compile time isssues with Xcode 4

Protect.command

Remove  cd ${CONFIGURATION_BUILD_DIR}${PUBLIC_HEADERS_FOLDER_PATH}
Add ${CONFIGURATION_BUILD_DIR}/..${PUBLIC_HEADERS_FOLDER_PATH}

Paths.xcconfig

Remove HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) “$(CONFIGURATION_BUILD_DIR)/../three20”
Add HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) “$(CONFIGURATION_BUILD_DIR)/../../three20”

Main project build settings

OTHER_LDFLAGS = (
    “-ObjC”,
    “-licucore”,
    “-all_load”,
);

Blogged with the Flock Browser