Archivi categoria: Apple

Xcode App Transport Security fix in Xcode 7, and resolve ‘Could not connect to the server’ errors

Apple made a radical decision with iOS 9, disabling all unsecured HTTP traffic from iOS apps, as a part of App Transport Security. This helps in enforcing security best practices, but if you  want to load external content, like arbitrary links, you have to add this value to your app info.plist:


Apple OSX Make an ISO from the

# ==============================================================
# 10.9. Make an ISO from the
# ==============================================================
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ -noverify -nobrowse -mountpoint /Volumes/install_app

# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Mavericks

# Increase the sparse bundle capacity to 8GB to accommodate the packages
hdiutil resize -size 8g /tmp/Mavericks.sparseimage

# Mount the sparse bundle for package addition
hdiutil attach /tmp/Mavericks.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

# Remove Package link and replace with actual files
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/

# Unmount the installer image
hdiutil detach /Volumes/install_app

# Unmount the sparse bundle
hdiutil detach /Volumes/install_build

# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/Mavericks.sparseimage | tail -n 1 | awk ‘{ print $1 }’`b /tmp/Mavericks.sparseimage

# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Mavericks.sparseimage -format UDTO -o /tmp/Mavericks

# Remove the sparse bundle
rm /tmp/Mavericks.sparseimage

# Rename the ISO and move it to the desktop
mv /tmp/Mavericks.cdr ~/Desktop/Mavericks.iso

iPhone Dev – Asynchronous image downloader with cache support with an UIImageView category

Here git of Asynchronous image downloader with cache support with an UIImageView category. This library provides a category for UIImageVIew with support for remote images coming from the web.

It provides:

  • An UIImageView category adding web image and cache management to the Cocoa Touch framework
  • An asynchronous image downloader
  • An asynchronous memory + disk image caching with automatic cache expiration handling
  • Animated GIF support
  • WebP format support
  • A background image decompression
  • A guarantee that the same URL won’t be downloaded several times
  • A guarantee that bogus URLs won’t be retried again and again
  • A guarantee that main thread will never be blocked
  • Performances!
  • Use GCD and ARC

IOS iPhone/iPad – check call service capability of the device

sometimes you need to check the type of device that will use our application in order to identify whether the device is an iphone, ipod or iPad. To check this we can read the [UIDevice currentDevice].model such you are essentially comparing the device name with a hard-coded value. Example

if(![[UIDevice currentDevice].model isEqualToString:@"iPhone"])
UIAlertView *alertView = [UIAlertView alloc] initWithTitle:@"Error"
message:@"Call service not avalible on this device"
otherButtonTitles: nil];
[alertView show];
[alertView release];

as alternative we can add a control if the device can openURL “tel:xxx-xxxx-xxxx” which is the protocol used to make a call on an iPhone device:

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:RISTOSTREGA_PHONE]]

more in deep we ca use to know exactly the generation of device the class UIDeviceHardware:

UIDeviceHardware *h=[[UIDeviceHardware alloc] init];
[self setDeviceModel:[h platformString]];
[h release];

the class UIDeviceHardware.h:

@interface UIDeviceHardware : NSObject
- (NSString *) platform;
- (NSString *) platformString;

in the implementation file UIDeviceHardware.m:


@implementation UIDeviceHardware

- (NSString *) platform{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithCString:machine];
return platform;

- (NSString *) platformString{
NSString *platform = [self platform];
if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 4G";
if ([platform isEqualToString:@"i386"]) return @"iPhone Simulator";
return platform;


Integrate the three20 library into your iOS project in 3 steps without error Can’t find #import “Three20/Three20.h”

Download three20 library with this command git clone git://

1) Copy the three20 folder into your iphone project: goto in [YourProjectsFolders]/[iOSProjectName] and copy three20 folder here
2) from console locate the three20 folder and run this python command
python src/scripts/ -p ../[iOSProjectName].xcodeproj Three20 -c Debug -c Release
3) now go to XCode and build. If yet opened reload project.