loading image from iOS Photo Library with ofxiPhoneImagePicker

hi,

this might be a simple question for most of you (I hope!) so hopefully someone can help me:
I am trying to load an image from my iOS image library using a modified ofxiPhoneImagePicker example. It does open the photo library as I double tap but then it gets stuck. I guess I have to somehow tell it to wait until the user has chosen an image and then load that image but I don’t know how…
I checked out different other posts in the forum but they didn’t help me…
so there is my code:

testapp.h

  
#pragma once  
  
#include "ofMain.h"  
#include "ofxiPhone.h"  
#include "ofxiPhoneExtras.h"  
  
class testApp : public ofxiPhoneApp{  
	  
    public:  
        void setup();  
        void update();  
        void draw();  
        void exit();  
	  
        void touchDown(ofTouchEventArgs & touch);  
        void touchMoved(ofTouchEventArgs & touch);  
        void touchUp(ofTouchEventArgs & touch);  
        void touchDoubleTap(ofTouchEventArgs & touch);  
        void touchCancelled(ofTouchEventArgs & touch);  
	  
        void lostFocus();  
        void gotFocus();  
        void gotMemoryWarning();  
        void deviceOrientationChanged(int newOrientation);  
	  
        ofxiPhoneImagePicker * camera;  
        ofxiPhoneImagePicker * library;  
      
        ofImage	photo;  
        ofPoint imgPos;  
	  
};  

testapp.mm

  
#include "testApp.h"  
  
//--------------------------------------------------------------  
void testApp::setup(){	  
    ofBackground(0);  
      
    ofSetOrientation(OF_ORIENTATION_90_RIGHT);  
	  
    camera = NULL;  
    library= NULL;  
	  
    imgPos.x=ofGetWidth()/2;  
	imgPos.y=ofGetHeight()/2;  
	  
	photo.loadImage("images/instructions.png");  
}  
  
  
//--------------------------------------------------------------  
void testApp::update(){  
   /* if(camera) {  
        if(camera->imageUpdated){  
              
            int cameraW = camera->width;  
            int cameraH = camera->height;  
            unsigned const char * cameraPixels = camera->pixels;  
              
            photo.setFromPixels(cameraPixels, cameraW, cameraH, OF_IMAGE_COLOR_ALPHA);  
              
            imgPos.x = ofGetWidth()/2;  
            imgPos.y = ofGetHeight()/2;  
              
            camera->close();  
            delete camera;  
            camera = NULL;  
        }  
    }*/  
    if(library) {  
          
              
            int libraryW = library->width;  
            int libraryH = library->height;  
            unsigned const char * libraryPixels = library->pixels;  
              
            photo.setFromPixels(libraryPixels, libraryW, libraryH, OF_IMAGE_COLOR_ALPHA);  
              
            imgPos.x = ofGetWidth()/2;  
            imgPos.y = ofGetHeight()/2;  
              
            library->close();  
            //delete library;  
            library = NULL;  
          
    }  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
    int x = imgPos.x - photo.width / 2;  
    int y = imgPos.y - photo.height / 2;  
	photo.draw(x, y);  
}  
  
//--------------------------------------------------------------  
void testApp::exit() {  
}  
  
  
//--------------------------------------------------------------  
void testApp::touchDown(ofTouchEventArgs & touch){  
	if(touch.id == 1){  
		  
        /*if(!camera) {  
            camera = new ofxiPhoneImagePicker();  
            camera->setMaxDimension(MAX(ofGetWidth(), ofGetHeight())); // max the photo taken at the size of the screen.  
            camera->openCamera();  
//            camera->showCameraOverlay();  
        }*/  
        if(!library) {  
            library = new ofxiPhoneImagePicker();  
            library->setMaxDimension(MAX(ofGetWidth(), ofGetHeight())); // max the photo taken at the size of the screen.  
            library->openLibrary();  
            //            camera->showCameraOverlay();  
        }  
          
		imgPos.x=ofGetWidth()/2;  
		imgPos.y=ofGetHeight()/2;  
	}  
}  
  
//--------------------------------------------------------------  
void testApp::touchMoved(ofTouchEventArgs & touch){  
	if(touch.id == 0){  
		imgPos.x=touch.x;  
		imgPos.y=touch.y;  
	}		  
}  

Check out Theo reply in this post http://forum.openframeworks.cc/t/how-to-load-and-draw-image-from-photoalbum-/11230/7