< 문제 해결 방법 >


Project -> Edit Project Settings 에서


Build 에서 Architectures 를 보시면

Base SDK 항목이 있습니다.

기존의 4.1 에서 4.2 로 변경꼭 XCode 를 재실행 하셔야 문제없이 프로젝트가 빌드 됩니다.



출처 : http://blog.naver.com/PostView.nhn?blogId=ydk928&logNo=60118866039
Posted by 오늘마감
[아이폰 앱 개발] Display the Network Activity Status Indicator

Display the Network Activity Status Indicator

This is the rotating icon displayed on the iPhone status bar in the upper left to indicate there is background network activity taking place.
UIApplication* app = [UIApplication sharedApplication]; app.networkActivityIndicatorVisible = YES; // to stop it, set this to NO


http://www.iphoneexamples.com/
Posted by 오늘마감
[아이폰 앱 개발] iphone crash log 위치 on the MAC 및 로그까는 symbolicatecrash프로그램 및 설치하기 명령어

IPhone Crash Logs

Sometimes programs crash. This annoys users and developers alike. Users are frustrated because they cannot use crashing software, developers are frustrated because they have to hunt bugs instead of doing something creative and rewarding. How do we communicate if an iPhone application crashes?

I’ll start with a disclaimer. I’m not sure whether the information provided in this post is covered by iPhone Developer Program NDA or not. If it is, the post will be removed. Secondly, this post is a result of googling, so I haven’t invented anything new here.

Working with crash logs typically involves certain interaction between developers and users, unless they are automagically sent to the developer. First of all, the user should get the crash log and send it to the developer, who should examine it, find the bug and fix it.

iPhone OS and Mac OS X are remarkably similar architectures. Both store crash logs to help identify crashing bugs. The difference between the two is how users retrieve them. On Mac OS X every user has unrestricted access to crash logs related to the applications she runs. The iPhone does not even have a file browser. What to do? iTunes comes to the rescue.

Whenever you synchronize your iPhone or iPod Touch, all the crash logs are transferred to your computer. Here are their locations:

  • Mac OS X:~/Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>
  • Windows XPC:\Documents and Settings\<USERNAME>\Application Data\Apple computer\Logs\CrashReporter/<DEVICE_NAME>
  • Windows VistaC:\Users\<USERNAME>\AppData\Roaming\Apple computer\Logs\CrashReporter/MobileDevice/<DEVICE_NAME>

The log file names start with application name and have the extension “crash”. They are just plain text files and can be sent by e-mail in original or zipped form, or even copy-pasted into your e-mail program.

The second part is trickier. Both Apple and common sense suggest that all AppStore binaries are shipped with stripped symbols. If you ever saw a crash log like this, read on:


까보면 아래처럼 나옮.. 저 밑에 어플리케이션하나 설치하면 크래쉬로그를 인간이 이해할 수 있는 

메모리에서 돌아가던 콘트롤명이나 생성한 객체들이나 이벤트들이 보이게됨.


Thread 0 Crashed:
0   libobjc.A.dylib           0x300c87ec 0x300bb000 + 55276
1   MobileLines               0x00006434 0x1000 + 21556
2   MobileLines               0x000064c2 0x1000 + 21698
3   UIKit                     0x30a740ac 0x30a54000 + 131244
4   UIKit                     0x30a66110 0x30a54000 + 74000
5   UIKit                     0x30a6565c 0x30a54000 + 71260
6   GraphicsServices          0x3169b0b4 0x31696000 + 20660
7   GraphicsServices          0x3169d818 0x31696000 + 30744
8   IOMobileFramebuffer       0x31f3e8f8 0x31f3d000 + 6392
9   com.apple.framework.IOKit 0x30f342b8 0x30f30000 + 17080
10  CoreFoundation            0x3025ced4 0x30229000 + 212692
11  CoreFoundation            0x3025bed6 0x30229000 + 208598
12  CoreFoundation            0x3025b584 0x30229000 + 206212
13  GraphicsServices          0x316998e4 0x31696000 + 14564
14  UIKit                     0x30a5e308 0x30a54000 + 41736
15  UIKit                     0x30a671dc 0x30a54000 + 78300
16  MobileLines               0x00002090 0x1000 + 4240
17  MobileLines               0x0000202c 0x1000 + 4140

In a nutshell, it contains function addresses and offsets instead of function names and line numbers. The structure is obvious, but, to be honest, I don’t know what “MobileLines 0×00006434 0×1000 + 21556″ is, even though I have all the source code. Thanks to Apple Developer Tools and to Craig Hockenberry who wrote about it, we have a perfect solution called symbolicatecrash.


위의 크래쉬로그를 가독성있게 분석할 수 있도록하는 툴


/usr/local/bin/으로 위의 프로그램 옮기고

$ sudo cp /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash /usr/local/bin/

위의 명령어로 설치하고

$ symbolicatecrash report.crash MobileLines.app.dSYM > report-with-symbols.crash

통해  크래쉬로그를 가독성있도록 바꿈


I copied it to /usr/local/bin/ so that I can run it whenever I want without trying to remember its original location (you may prefer a symbolic link):
$ sudo cp /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash /usr/local/bin/

Running this script with the -h option provides the minimal help:

$ symbolicatecrash -h
usage:

    symbolicatecrash [-Ah] LOGFILE [SYMBOL_PATH ...]

    Symbolicates a crashdump LOGFILE which may be "-" to refer
  to stdin. By default, all heuristics will be employed
  in an attempt to symbolicate all addresses. Additional
  symbol files can be found under specified directories.

Options:
    -A  Only symbolicate the application, not libraries
    -h  Display this message
    -v  Verbose

To add symbols to the crash log you need the dSYM file generated by the linker when you compiled your application for AppStore. In other words, when you build for AppStore you should keep the dSYM package in a safe place backed up by Time Machine. This is very important. You should keep a copy of the dSYM for each version of your application ever shipped. If you have the package, translating code offsets to function names with line numbers has never been easier:

$ symbolicatecrash report.crash MobileLines.app.dSYM > report-with-symbols.crash

Here is the result:


Thread 0 Crashed:
0   libobjc.A.dylib           0x300c87ec objc_msgSend + 20
1   MobileLines               0x00006434 -[BoardView setSelectedPiece:] (BoardView.m:321)
2   MobileLines               0x000064c2 -[BoardView touchesBegan:withEvent:] (BoardView.m:349)
3   UIKit                     0x30a740ac -[UIWindow sendEvent:] + 264
4   UIKit                     0x30a66110 -[UIApplication sendEvent:] + 248
5   UIKit                     0x30a6565c _UIApplicationHandleEvent + 4088
6   GraphicsServices          0x3169b0b4 PurpleEventCallback + 428
7   GraphicsServices          0x3169d818 HeartbeatVBLCallback + 152
8   IOMobileFramebuffer       0x31f3e8f8 IOMobileFramebufferNotifyFunc + 124
9   com.apple.framework.IOKit 0x30f342b8 IODispatchCalloutFromCFMessage + 304
10  CoreFoundation            0x3025ced4 __CFMachPortPerform + 72
11  CoreFoundation            0x3025bed6 CFRunLoopRunSpecific + 2364
12  CoreFoundation            0x3025b584 CFRunLoopRunInMode + 44
13  GraphicsServices          0x316998e4 GSEventRunModal + 268
14  UIKit                     0x30a5e308 -[UIApplication _run] + 404
15  UIKit                     0x30a671dc UIApplicationMain + 1064
16  MobileLines               0x00002090 main (main.m:16)
17  MobileLines               0x0000202c start + 44

Now, this is much better. Happy debugging!

Other useful references:

http://www.anoshkin.net/blog/2008/09/09/iphone-crash-logs/
    Posted by 오늘마감
    [아이폰 앱 개발] CATransition showing a single frame from the end of the transition before the animation starts

      CATransition showing a single frame from the end of the transition before the animation starts
     

    I am using some code which was originally taken from the Apple sample ViewTransitions to swap two views with each other.

    CATransition *animation = [CATransition animation];
    [animation setDelegate:self];
    [animation setType:kCATransitionFade];
    [animation setDuration:0.3f];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
    [[container layer] addAnimation:animation forKey:@"swap"];

    When my transition executes on the devlice, I sometimes get a single frame flash of the final frame of the transition animation and then the animation plays smoothly. This gives a very jarring effect of the 2nd view which flickers in and then out again before the smooth animation executes.

    The main difference between my example and the Apple example is that my views are not full screen, I have a container UIView which contains both sub-views and I am applying my animation to the container layer instead the root view layer. I can not see that this should make much difference though.

    This issue does not happen at all in the simulator and is intermittent (about 60-70% of the time) on the device. Is anyone else seeing this behaviour and if so, how did you work around it?

    Updated with more information: The code was originally part of a multi part animation but I moved it to be triggered by a button to isolate the problem. The issue occurs in both situations.

    The animation delegates were implemented but have been removed to try and isolate the problem.

    The views are not changing during the animation and in fact [container setUserInteractionEnabled:NO] is being called (but the problem also happens without user interaction being disabled).

    I have tried starting the animation from the middle of the transition and ending before the end usingsetStartProgress and setEndProgress, again the problem persists.

    I have tried slowing the animation duration right down as well with no effect.

        262508        Dave Verwer        iphone  cocoa-touch  core-animation  objective-c  


     

    I can't post comment, but the same as teabot : I did what you said and it doesn't do the trick... Do you have more explanations on the subject ?

        1410428        Unfalkster        iphone  cocoa-touch  core-animation  objective-c  


     

    Solved, I had missed a key piece of this that I thought was irrelevant ;) After setting up the animation in the code sample above, I was swapping the views out in the same method.

    Moving it to the animationDidStart delegate fixed the issue.

        268456        Dave Verwer        iphone  cocoa-touch  core-animation  objective-c  


      Can you give some example code of this in action please? I have implemented what I understand by your description but my 'glitch frame' persists. #1226703    teabot


     

    To begin to answer your question more information is needed - for instance, how are you calling that code (e.g. is it bound to a button as an action or is it triggered automatically somehow), have you implemented the delegate methods to start and stop the animation (and what is contained within them), and are your views changing at some point during the animation? Timing between the simulator and device will be off - you should not rely on the simulator to test animation as everything will happen quicker.

    Posted by 오늘마감
    Prevent The iPhone From Sleeping

    Code Snippet: Prevent The iPhone From Sleeping

    If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

    The code below will prevent the iPhone from dimming its screen and ultimately going to sleep. Use it wisely as you don’t want your application becoming notorious for being a battery hog 

    [UIApplication sharedApplication].idleTimerDisabled = YES;

    밧데리를 엄청먹게되니 적절하게 적용
    Posted by 오늘마감
    how to make a UITextField move up when the keyboard is presented

    
    아래 답변대로 하되 매크로설정빼먹으면 오류~ 매크로수치만큼 뷰가 위로올라간다. 뷰가 움직이는 것이 감지되나 여전히 가리면 아래 매크로값을 조정하면 된다.
    
    
    일반 뷰에 텍스트필드가 있을때에도 가능하다.
    
    
    
    
    #define kOFFSET_FOR_KEYBOARD 120.0
    

    With the iPhone SDK:

    I have a UIView with UITextFields that brings up a keyboard. I need it to be able to:

    1. Allow scrolling of the contents of the UIScrollView to see the other text fields once the keyboard is brought up
    2. Automatically "jump" (by scrolling up) or shortening

    I know that I need a UIScrollView. I've tried changing the class of my UIView to a UIScrollView but I'm still unable to scroll the textboxes up or down.

    Do I need both a UIView and a UIScrollView? Does one go inside the other? [EDIT: I now know that you want a UIView inside of a UIScrollView, and the trick is to programatically set the content size of the UIScrollView to the frame size of the UIView.]

    Then what needs to be implemented in order to automatically scroll to the active text field?

    Ideally as much of the setup of the components as possible will be done in Interface Builder. I'd like to only write code for what needs it.

    Note: the UIView (or UIScrollView) that I'm working with is brought up by a tabbar (UITabBar), which needs to function as normal.


    http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present


    Edit: I am adding the scroll bar just for when the keyboard comes up. Even though it's not needed, I feel like it provides a better interface because then the user can scroll and change textboxes, for example.

    I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using: 

    
    -(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y,                                                    scrollView.frame.size.width, scrollView.frame.size.height - 215 + 50); //resize } 
    -(void)textFieldDidEndEditing:(UITextField *)textField { //keyboard will hide scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height + 215 - 50); //resize }
    However this doesn't automatically "move up" or center the lower text fields in the visible area, which is what I would really like.
    flag

    12 Answers

    9

    1) You will need a scroll view if the contents you have now does not fit in iphone screen. [If you are adding the scroll view just to make the textfield scroll up when keyboard comes up, then its not needed]

    2) For showing the textfields without being hidden by the keyboard, the standard way is to move up/down the view having textfields whenever the keyboard is shown

    here is a sample code

    
    -(void)textFieldDidBeginEditing:(UITextField*)sender
    {
    if([sender isEqual:_textField])
    {
    //move the main view, so that the keyboard does not hide it.
    if (self.view.frame.origin.y >=0)
    {
    [self setViewMovedUp:YES];
    }
    }
    }

    //method to move the view up/down whenever the keyboard is shown/dismissed
    -(void)setViewMovedUp:(BOOL)movedUp
    {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];// if you want to slide up the view

    CGRect rect =self.view.frame;
    if(movedUp)
    {
    // 1. move the view's origin up so that the text field that will be hidden come above the keyboard
    // 2. increase the size of the view so that the area behind the keyboard is covered up.
    rect
    .origin.y -= kOFFSET_FOR_KEYBOARD;
    rect
    .size.height += kOFFSET_FOR_KEYBOARD;
    }
    else
    {
    // revert back to the normal state.
    rect
    .origin.y += kOFFSET_FOR_KEYBOARD;
    rect
    .size.height -= kOFFSET_FOR_KEYBOARD;
    }
    self.view.frame = rect;

    [UIView commitAnimations];
    }


    -(void)keyboardWillShow:(NSNotification*)notif
    {
    //keyboard will be shown now. depending for which textfield is active, move up or move down the view appropriately

    if([_textField isFirstResponder]&&self.view.frame.origin.y >=0)
    {
    [self setViewMovedUp:YES];
    }
    elseif(![_textField isFirstResponder]&&self.view.frame.origin.y <0)
    {
    [self setViewMovedUp:NO];
    }
    }


    -(void)viewWillAppear:(BOOL)animated
    {
    // register for keyboard notifications
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
    name
    :UIKeyboardWillShowNotificationobject:self.view.window];
    }

    -(void)viewWillDisappear:(BOOL)animated
    {
    // unregister for keyboard notifications while not visible.
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotificationobject:nil];
    }

    define kOFFSET_FOR_KEYBOARD to a value as needed. like

    
    #define kOFFSET_FOR_KEYBOARD 60.0

    Hope this helps




    Posted by 오늘마감
    hide the back button in BarButton of navigation bar
    2

    As far as I know thats correct behavior. I've had that happen every time I've hidden the back button.

    Try using.

    
    self.navigationItem.leftBarButtomItem =nil;
    link|flag
    Posted by 오늘마감
    The Basics of Protocols and Delegates

    The Basics of Protocols and Delegates



    출처 : http://blog.naver.com/PostList.nhn?blogId=philipousys¤tPage=44
    Posted by 오늘마감
    how to make a UITextField move up when the keyboard is presented

    With the iPhone SDK:

    I have a UIView with UITextFields that brings up a keyboard. I need it to be able to:

    1. Allow scrolling of the contents of the UIScrollView to see the other text fields once the keyboard is brought up
    2. Automatically "jump" (by scrolling up) or shortening

    I know that I need a UIScrollView. I've tried changing the class of my UIView to a UIScrollView but I'm still unable to scroll the textboxes up or down.

    Do I need both a UIView and a UIScrollView? Does one go inside the other? [EDIT: I now know that you want a UIView inside of a UIScrollView, and the trick is to programatically set the content size of the UIScrollView to the frame size of the UIView.]

    Then what needs to be implemented in order to automatically scroll to the active text field?

    Ideally as much of the setup of the components as possible will be done in Interface Builder. I'd like to only write code for what needs it.

    Note: the UIView (or UIScrollView) that I'm working with is brought up by a tabbar (UITabBar), which needs to function as normal.

    http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present


    Edit: I am adding the scroll bar just for when the keyboard comes up. Even though it's not needed, I feel like it provides a better interface because then the user can scroll and change textboxes, for example.

    I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using: 

    -(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y, 							 scrollView.frame.size.width, scrollView.frame.size.height - 215 + 50); //resize } 

    -(void)textFieldDidEndEditing:(UITextField *)textField { //keyboard will hide scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height + 215 - 50); //resize }

    However this doesn't automatically "move up" or center the lower text fields in the visible area, which is what I would really like.
    flag

       

    12 Answers

    9

    1) You will need a scroll view if the contents you have now does not fit in iphone screen. [If you are adding the scroll view just to make the textfield scroll up when keyboard comes up, then its not needed]

    2) For showing the textfields without being hidden by the keyboard, the standard way is to move up/down the view having textfields whenever the keyboard is shown

    here is a sample code

    -(void)textFieldDidBeginEditing:(UITextField*)sender
    {
       
    if([sender isEqual:_textField])
       
    {
           
    //move the main view, so that the keyboard does not hide it.
           
    if  (self.view.frame.origin.y >=0)
           
    {
               
    [self setViewMovedUp:YES];
           
    }
       
    }
    }

    //method to move the view up/down whenever the keyboard is shown/dismissed
    -(void)setViewMovedUp:(BOOL)movedUp
    {
       
    [UIView beginAnimations:nil context:NULL];
       
    [UIView setAnimationDuration:0.5];// if you want to slide up the view

       
    CGRect rect =self.view.frame;
       
    if(movedUp)
       
    {
           
    // 1. move the view's origin up so that the text field that will be hidden come above the keyboard
           
    // 2. increase the size of the view so that the area behind the keyboard is covered up.
            rect
    .origin.y -= kOFFSET_FOR_KEYBOARD;
            rect
    .size.height += kOFFSET_FOR_KEYBOARD;
       
    }
       
    else
       
    {
           
    // revert back to the normal state.
            rect
    .origin.y += kOFFSET_FOR_KEYBOARD;
            rect
    .size.height -= kOFFSET_FOR_KEYBOARD;
       
    }
       
    self.view.frame = rect;

       
    [UIView commitAnimations];
    }


    -(void)keyboardWillShow:(NSNotification*)notif
    {
       
    //keyboard will be shown now. depending for which textfield is active, move up or move down the view appropriately

       
    if([_textField isFirstResponder]&&self.view.frame.origin.y >=0)
       
    {
           
    [self setViewMovedUp:YES];
       
    }
       
    elseif(![_textField isFirstResponder]&&self.view.frame.origin.y <0)
       
    {
           
    [self setViewMovedUp:NO];
       
    }
    }


    -(void)viewWillAppear:(BOOL)animated
    {
       
    // register for keyboard notifications
       
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
                                                                                             name
    :UIKeyboardWillShowNotificationobject:self.view.window];
    }

    -(void)viewWillDisappear:(BOOL)animated
    {
         
    // unregister for keyboard notifications while not visible.
       
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotificationobject:nil];
    }

    define kOFFSET_FOR_KEYBOARD to a value as needed. like

    #define kOFFSET_FOR_KEYBOARD 60.0

    Hope this helps



    출처 : http://blog.naver.com/PostList.nhn?blogId=philipousys¤tPage=41
    Posted by 오늘마감
    hide the back button in BarButton of navigation bar
    2

    As far as I know thats correct behavior. I've had that happen every time I've hidden the back button.

    Try using.

    self.navigationItem.leftBarButtomItem =nil;
    link|flag
    Posted by 오늘마감