티스토리 툴바



원본 : http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

스크립트 내용 :

# Purpose:
#   Create a static library for iPhone from within XCode
#   Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)
#   ...no, I don't understand why they did such a stupid thing either!
#
# Author: Adam Martin - http://twitter.com/redglassesapps
# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)
#
# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4


#####################[ part 1 ]##################
# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)
#    (incidental: searching for substrings in sh is a nightmare! Sob)

SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\{3\}$')

# Next, work out if we're in SIM or DEVICE

if [ ${PLATFORM_NAME} = "iphonesimulator" ]
then
OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}
else
OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}
fi

echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})"
echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}"
#
#####################[ end of part 1 ]##################

#####################[ part 2 ]##################
#
# IF this is the original invocation, invoke WHATEVER other builds are required
#
# Xcode is already building ONE target...
#
# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.
# ...we need to build ALL targets
# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)
#
#
# So: build ONLY the missing platforms/configurations.

if [ "true" = ${ALREADYINVOKED} ]
then
echo "RECURSION: I am NOT the root invocation, so I'm NOT going to recurse"
else
# CRITICAL:
# Prevent infinite recursion (Xcode sucks)
export ALREADYINVOKED="true"

echo "RECURSION: I am the root ... recursing all missing build targets NOW..."
echo "RECURSION: ...about to invoke: xcodebuild -configuration \"${CONFIGURATION}\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUULD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO"
xcodebuild -configuration "${CONFIGURATION}" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO
fi

ACTION="build"

#Merge all platform binaries as a fat binary for each configurations.

CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos
CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator
CURRENTCONFIG_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal

# ... remove the products of previous runs of this script
#      NB: this directory is ONLY created by this script - it should be safe to delete!

rm -rf "${CURRENTCONFIG_UNIVERSAL_DIR}"
mkdir "${CURRENTCONFIG_UNIVERSAL_DIR}"

#
echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CURRENTCONFIG_UNIVERSAL_DIR}/${EXECUTABLE_NAME}"
lipo -create -output "${CURRENTCONFIG_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}"

#########
#
# Added: StackOverflow suggestion to also copy "include" files
#    (untested, but should work OK)
#
if [ -d "${CURRENTCONFIG_DEVICE_DIR}/usr/local/include" ]
then
  mkdir -p "${CURRENTCONFIG_UNIVERSAL_DIR}/usr/local/include"
  cp "${CURRENTCONFIG_DEVICE_DIR}"/usr/local/include/* "${CURRENTCONFIG_UNIVERSAL_DIR}/usr/local/include"
fi
 
저작자 표시 비영리 변경 금지

'iPhone' 카테고리의 다른 글

xcode device+simul script  (0) 2011/10/17
[아이폰] archive & unarchive  (0) 2011/03/18
[아이폰] 디렉토리  (0) 2011/03/14
[iPhone] Property 속성 키워드  (0) 2011/03/14
아이폰 - 문자열 NSString  (0) 2010/04/19
아이폰 - Objective-C Header File  (0) 2010/04/15
Posted by 오늘을살자


그동안 메일만 사용하다가 다음 클라우드 앱 받아서 사용중...

이동시에 첨부파일 메일 보내기 참 쉽네요...

UI나 사용성도 N드라이브에 뒤지지 않을 듯...

N드라이브는 UI를 많이 개선했는데... 사진쪽은 오히려 불편해 졌네요... ㅡ.ㅡ;;

다음 클라우드는 사진을 폴더별로 볼 수 있어서 좋습니다... ^^
저작자 표시 비영리 변경 금지
Posted by 오늘을살자


출처 : 데브로이드의 개발 이야기 (http://devroid.com/80114347358)

아카이브는 객체의 직렬화를 뜻한다. 즉, 객체를 저장하고 복원할 때는 객체를 바이트스트림같은 직렬 형태로 저장하여 복원하는데, 이런 직렬화를 아카이브라고 한다.


아카이버는 객체를 아카이브시키는 행위자에 해당하겠다. 이러한 아카이버는 아카이브 시키려는 객체가 NSCoding 이라는 프로토콜을 구현하고 있다고 가정을 한다. 그래서, 아카이버 자신은 객체의 클래스 정보를 저장하고, 그다음 객체에게 incodeWithCoder: 메시지를 던져줘서 객체 자신이 자신의 데이터를 저장하게끔 해준다.


아카이버는 두가지 종류가 있다.

객체의 인코딩 순서를 그대로 재현하여 디코딩시키는 아카이버와, 아카이브시킬때 데이터마다 고유의 키값을 부여하여 디코딩시킬 때 이 키를 이용해서 디코딩하므로 인코딩 순서를 따르지 않아도 되는 아카이버가 있다.


--------------


1. 아카이브시킬 객체의 클래스를 선언한다. ( 속성 선언 및 메모리 해제는 다른것과 동일 )


@interface ArcData : NSObject <NSCoding> {

NSString* data1;

NSString* data2;

}


2. NSCoding 프로토콜의 메서드를 정의해준다.


- (void)encodeWithCoder:(NSCoder *)encoder {

[encoder encodeObject:data1 forKey:@"data1"];

[encoder encodeObject:data2 forKey:@"data2"];

}


=> 인코딩시에는 인코더가 encodeWithCoder: 메서드를 호출해주는데, 이 메서드에서는 인자로 넘겨받은 인코더 객체의 encodeObject 메서드를 호출해주며, 저장할 데이터와 해당 키를 지정해준다.


- (id)initWithCoder:(NSCoder *)decoder {

if ( self = [super init] ) {

self.data1 = [decoder decodeObjectForKey:@"data1"];

self.data2 = [decoder decodeObjectForKey:@"data2"];

}

return self;

}


=> 디코딩시에는 디코더가 initWithCoder: 메서드를 호출해주는데, 객체를 초기화해주면서 디코더에서 키에 해당하는 값을 얻어와서 멤버변수를 초기화해주는 처리를 해준다.


3. 위와 같이 NSCoder 프로토콜을 따르는 클래스를 정의해주고 아래와 같은 절차로 인코딩, 디코딩을 한다. ( 아래의 예에서는 인코딩하여 파일로 저장하고, 파일에 저장된 것을 불러와서 디코딩하는 예 )


<< 인코딩 절차 >>


// 파일명 정의

NSArray* path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString* documentDirectory = [path objectAtIndex:0];

NSString* fileName = [documentDirectory stringByAppendingFormat:@"fname"];


// 객체 생성 및 값이 설정

ArcData* arcData = [[ArcData alloc] init];

arcData.data1 = @"data1";

arcData.data2 = @"data2";


// 인코더 생성

NSMutableData* data = [[NSMutableData alloc] init];

NSKeyedArchiver* archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];


=> 위와 같이 NSMutableData 객체를 이용해서 인코더를 생성한다.


// 객체를 인코딩 ( 인코딩시 객체의 키를 지정해줌 )

[archiver encodeObject:arcData forKey:@"data"];

[archiver finishEncoding];


// 인코딩된 데이터를 파일로 저장

[data writeToFile:fileName atomically:YES];


// 메모리 해제

[arcData release];

[archiver release];

[data release];



<< 디코딩 절차 >>


// 파일로부터 NSData 객체 초기화

NSData* data = [[NSMutableData alloc] initWithContentsOfFile:fileName]];


// 디코더 정의

NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];


// 디코더를 이용하여 NSData 객체를 ArcData로 언아카이브 시킴

ArcData* arcData = [unarchiver decodeObjectForKey:@"data"];

[unarchiver finishDecoding];


// 위와 같이 언아카이브 시켰을때 arcData 객체의 data1과 data2 멤버변수에는 @"data1", @"data2" 가 설정되어 있게 된다.


// 메모리 해제

[unarchiver release];

[data release];

저작자 표시 비영리 변경 금지

'iPhone' 카테고리의 다른 글

xcode device+simul script  (0) 2011/10/17
[아이폰] archive & unarchive  (0) 2011/03/18
[아이폰] 디렉토리  (0) 2011/03/14
[iPhone] Property 속성 키워드  (0) 2011/03/14
아이폰 - 문자열 NSString  (0) 2010/04/19
아이폰 - Objective-C Header File  (0) 2010/04/15
Posted by 오늘을살자
이전버튼 1 2 3 4 5 ... 65 이전버튼

블로그 이미지
Android PL/SQL Java & JSP Book PMP
오늘을살자
Yesterday77
Today14
Total91,565
Statistics Graph

달력

 « |  » 2012.01
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31