다른 방법이 있어 추가한다.
Organizer - Projects 에서 해당 프로젝트를 제거한 후 xcode 에서 프로젝트를 다시 열면 된다.
다시 열 때 Organizer - Projects 에도 다시 등록된다.


코드를 수정하던 중, 또는 소스를 다시 받았을 경우 "Code highlight" (또는 "Code coloring") 이 동작하지 않는 경우가 있다.

하얀색 글자들을 바라보자니 정신이 혼미해진다.

해결방법은 Header 탐색 경로를 수정하면 된다.


1. Project - Build settings - Search Paths 로 이동

2. Header Search Paths 에 "$(SRCROOT)/**" 을 추가한다.

3. 잠시 대기


이렇게 해도 해결이 안되면 다음 원문의 3번 부터 따라해보자.

원문: http://stackoverflow.com/questions/2138047/xcode-code-loses-syntax-coloring

Audio 재생 관련 검색을 하던 중 Matt Gallagher 의 AudioStreamer 를 받게되었다.

git read-only 주소가 공개되어있어 git 로 받기로 했다.

받으려는 폴더로 이동하여 다음과 같이 입력하면 된다.

$ git clone [git 주소]


UIImage 의 일부 영역을 CGImage 로 변환 후 UIImage 로 변환


CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, 0, iWidth, iHeight));
UIImage *image = [[UIImage imageWithCGImage:imageRef] autorelease];
CGImageRelease(imageRef); 
 

일반적으로 아이폰이나 아이패드처럼 아이콘을 길게 누르고 있으면 삭제버튼이 생긴다.
이중 삭제가 되지않는 것들을 삭제하는 방법이다.
아이콘 목록이 sqlite 로 관리되므로 DB 에서 삭제하면 된다.

다음을 터미널 창에서 실행한다.

1. sqlite 실행
  $ sqlite3 ~/Library/Application\ Support/Dock/*.db

2. 아이콘 목록 확인
  sqlite> select * from apps;

3. 원하는 title 의 아이콘 삭제
  sqlite> delete from apps where title='title'

4. sqlite 종료
  sqlite> .exit

5. LaunchPad 재실행
  $ killall Dock
 


1. 특정주기로 발생하는 타이머 (즉시 동작)
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(onTick) userInfo:nil repeats:YES];

호출 후 부터 1초마다 self 의 onTick 을 인자값 없이 반복 호출

2. 특정주기로 발생하는 타이머 (시작시간 조절)
[[NSRunLoop currentREunLoop] addTimer:[[[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:0.0] interval:9.0 target:self selector:@selector(onTick) userInfo:nil repeats:YES] autorelease] forMode:NSDefaultRunLoopMode];

1번과 유사한 동작이지만 initWithFireDate 에 명시한 시간부터 onTick 이 호출된다.
여기서는 dateWithTimeIntervalSinceNow:0.0 으로 즉시 onTick 이 호출되고, 이후 1초마다 호출된다. 
Apple Mach-O Linker (id) Error
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1


사례1. 헤더에서 변수를 생성하고, 이 헤더를 두군데 이상에서 포함시켰을 경우.

NSStringEncoding defaultEncoding = NSUTF8StringEncoding;

.m 파일에 있던 이 코드를 수정하던 도중 .h 에 옮기는 실수를 하였다.
C/C++ 의 경우라면 아무 문제없이 컴파일이 되지만 서로 다른 변수가 생겨 오동작이 되었을 경우다.
그러나 xcode 에서는 clang 에서 오류를 발생시킨다.

해당 코드는 .m 작성하고 .h 파일에
NSStringEncoding defaultEncoding;
을 넣어 참조하도록 하자.
NSMutableDicrionary 를 상속받아서 사용시에 몇가지 abstract method 를 구현해주어야 한다. 그렇지 않고 사용시 "method only defined for abstract class" 라는 디버깅 메세지를 만날 것이다.

다음은 override 해야할 method 들이다.

1. NSMutableDicrionary
 
2. NSDicrionary

클래스 레퍼런스를 링크하였으니 각 클래스 레퍼런스의 "Overview" 에 "Subclassing notes" 를 참고하면 된다. 이외의 다른 클래스들은 애플 개발자 사이트 (https://developer.apple.com/) 를 참고.

--------

추가. (2012/06/14) Class Cluster 에 대한 이해가 필요한 것이다.



'Mobile > iOS' 카테고리의 다른 글

UIImage 자르기  (0) 2012.03.20
[iOS] NSTimer 사용  (0) 2012.03.13
[Simul] 시뮬레이터에서 멀티터치 테스트  (0) 2012.02.28
[iOS] CoreData 추가하기  (0) 2012.02.24
[iOS] CFOptionFlags  (0) 2012.02.21
[[NSThreaed alloc] initWithTarget:self selector:@selector(method) object:obj];

- (void)method:(NSData *)data
{
}


실행시 method 가 없다고 에러난다. 
method 에는 인자값이 하나가 있으므로 @selector(method:) 로 명시해줘야한다.
 
OPT 키를 누르면 포인트 점 2개가 나타난다.
이후 클릭시 두군데를 동시에 누른것처럼 동작한다. 
1. Frameworks 에 CoreData.framework 추가.
2. Data Model 파일 (<Project-Name>.xcdatamodeld) 추가.
3. <Project-Name>.pch 에 "#import <CoreData/CoreData.h>" 추가. (위치는 눈치봐서 맞춰서 넣을 것)
4. AppDelegate 선언부에 다음을 추가.

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (NSURL *)applicationDocumentsDirectory; 



5. AppDelegate 구현부에 다음을 추가. <Project-Name> 이 두군데 있으니 잘 찾아서 수정.

#pragma mark - Core Data stack

/**
 Returns the managed object context for the application.
 If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
 */
- (NSManagedObjectContext *)managedObjectContext
{
    if (__managedObjectContext != nil)
    {
        return __managedObjectContext;
    }
    
    NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
    if (coordinator != nil)
    {
        __managedObjectContext = [[NSManagedObjectContext alloc] init];
        [__managedObjectContext setPersistentStoreCoordinator:coordinator];
    }
    return __managedObjectContext;
}

/**
 Returns the managed object model for the application.
 If the model doesn't already exist, it is created from the application's model.
 */
- (NSManagedObjectModel *)managedObjectModel
{
    if (__managedObjectModel != nil)
    {
        return __managedObjectModel;
    }
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"<Project-Name>" withExtension:@"momd"];
    __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
    return __managedObjectModel;
}

/**
 Returns the persistent store coordinator for the application.
 If the coordinator doesn't already exist, it is created and the application's store added to it.
 */
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
    if (__persistentStoreCoordinator != nil)
    {
        return __persistentStoreCoordinator;
    }
    
    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"<Project-Name>.sqlite"];
    
    NSError *error = nil;
    __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
    if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])
    {
        /*
         Replace this implementation with code to handle the error appropriately.
         
         abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 
         
         Typical reasons for an error here include:
         * The persistent store is not accessible;
         * The schema for the persistent store is incompatible with current managed object model.
         Check the error message to determine what the actual problem was.
         
         
         If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
         
         If you encounter schema incompatibility errors during development, you can reduce their frequency by:
         * Simply deleting the existing store:
         [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
         
         * Performing automatic lightweight migration by passing the following dictionary as the options parameter: 
         [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
         
         Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
         
         */
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }    
    
    return __persistentStoreCoordinator;
}

#pragma mark - Application's Documents directory

/**
 Returns the URL to the application's Documents directory.
 */
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}


 

+ Recent posts