starbugs / icedcoffee

A lightweight OpenGL user interface framework written in Objective-C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrating iced coffee into storyboard

opened this issue · comments

Hi

I have icedcoffe integrated into airplay, this was a straight port of one of the demo apps as the setup is handled in the AppDelegate.

But I now want to use icedCoffee in a view which is part of a storyboard, I have placed a simple UIViewController on the storyboard, this has a single UIView component.

I have then subclassed ICHostViewControllerIOS and put the test instantiation of icedCoffee into the viewDidLoad method.

[super viewDidLoad];
// Do any additional setup after loading the view.

ICGLView *glView = [ICGLView viewWithFrame:self.view.bounds
                               pixelFormat:kEAGLColorFormatRGB565
                               depthFormat:0 /* GL_DEPTH_COMPONENT24_OES */
                        preserveBackbuffer:NO
                                sharegroup:nil
                             multiSampling:NO
                           numberOfSamples:0];


[glView setMultipleTouchEnabled:YES];
[glView setHostViewController:self];
[self enableRetinaDisplaySupport:YES];

ICScene *scene = [ICScene scene];

NSString *filename = [[NSBundle mainBundle] pathForResource:@"thiswayup" ofType:@"png"];
ICTexture2D *texture = [[ICTextureCache currentTextureCache] loadTextureFromFile:filename];

for (int i=0; i<10; i++) {
    DraggableSprite *s = [DraggableSprite spriteWithTexture:texture];
    [s setPosition:kmVec3Make(arc4random() % 300, arc4random() % 400, 0)];
    [scene addChild:s];
}

[self runWithScene:scene];

I have set this as the view controller class in the storyboard

But at runtime the app crashes with this message:

-[UIView context]: unrecognized selector sent to instance 0x649fc0

I think that in this case the view controller is trying to render before I have initialised the ICGLView and called [glView setHostViewController:self]; so the view is the default UIView and not an instance of ICGLView.

Do you know how I might work around this?

TIA

Hi,

did you assign your custom ICHostViewControllerIOS subclass as the class for the view controller in the storyboard? If so, you will need to assign the ICGLView class to the UIView inside the view controller in interface builder. Then, there should be no need to instantiate it on your own in the viewDidLoad override anymore. It will "just be there", as the XIB will instantiate and initialize it for you. I think it is also possible to configure the view inside interface builder, but I'm not sure about how it handles that exactly.

Another issue may be that view controllers instantiated from XIBs do call – initWithNibName:bundle: instead of init. We should override that method in the framework so that this also works.

I hope you do not run into further trouble with this as I didn't test integrating the IC classes with interface builder yet. Please keep this issue open, I will create a test case for this and update the framework's sources if necessary.

Tobias

Tobias

Hi, I had tried assigning both ICHostViewControllerIOS and my subclass of ICHostViewControllerIOS, both with the same result. I had not set the UI View to ICGLView as I thought it needed the specific initialisation. I have set it now and get the same error which I thought was odd.

So I have done an experiment and I have it running, but it won't work in my setup.

If you create a storyboard and drag on a simple UIViewController, set the UIView Controller class to ICHostViewControllerIOS and the UIView class to ICGLView, then I see the following in the log:

IcedCoffee: GL supports ARB_pixel_buffer_object: NO
applicationDidBecomeActive called
IcedCoffee: surface size: 320x480
IcedCoffee: animation started

I didn't actually set a scene but this looks like icedcoffe is running

This is probably worth providing as a simple test case, but for me I think the issue is that I have a storyboard that has a top level TabBarController which has NavigationControllers on the Tabs, which have TableViewController to list items, which push the ICHostViewControllerIOSon the stack to render the detail for an item.

I suspect that somewhere iced coffee is getting the root view controller which for me would be the Tab Bar Controller

As side note storyboard has a GLKit View Controller and a GLKit View, these would be natural choices when building a storyboard, but have a different inheritance tree.

Tobias

Here is the part of the stack trace that I think relates to this issue:

0 CoreFoundation 0x3747188f exceptionPreprocess + 163
1 libobjc.A.dylib 0x35176259 objc_exception_throw + 33
2 CoreFoundation 0x37474a9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x37473915 __forwarding
+ 301
4 CoreFoundation 0x373ce650 _CF_forwarding_prep_0 + 48
5 IntellAgent 0x00045bc9 -ICHostViewController openGLContext
6 IntellAgent 0x00045a47 -ICHostViewController setView:
7 UIKit 0x31208ce7 -[UIViewController loadView] + 231
8 UIKit 0x3117ec17 -[UIViewController view] + 51
9 UIKit 0x3118b1e9 -[UIViewController contentScrollView] + 25
10 UIKit 0x3118b059 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 37
11 UIKit 0x3118af3f -[UINavigationController _layoutViewController:] + 35
12 UIKit 0x3118a7c1 -[UINavigationController _startTransition:fromViewController:toViewController:] + 501
13 UIKit 0x3118a503 -[UINavigationController _startDeferredTransitionIfNeeded] + 251
14 UIKit 0x3117eaff -[UINavigationController pushViewController:transition:forceImmediate:] + 807
15 UIKit 0x3117e7d5 -[UINavigationController pushViewController:animated:] + 37
16 UIKit 0x311f7903 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 887
17 UIKit 0x31271627 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 159
18 Foundation 0x37ce2933 __NSFireDelayedPerform + 415
19 CoreFoundation 0x37445a33 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 15
20 CoreFoundation 0x37445699 __CFRunLoopDoTimer + 365
21 CoreFoundation 0x3744426f __CFRunLoopRun + 1207
22 CoreFoundation 0x373c74a5 CFRunLoopRunSpecific + 301
23 CoreFoundation 0x373c736d CFRunLoopRunInMode + 105
24 GraphicsServices 0x33b86439 GSEventRunModal + 137
25 UIKit 0x31173cd5 UIApplicationMain + 1081
26 IntellAgent 0x00008b4f main (main.m:18)
27 IntellAgent 0x00008af4 start + 40

I just pushed a new branch "development", which includes a working Interface Builder integration test (see tests-ios/IBIntegrationTest, also included in the icedcoffee-tests-ios Xcode project). The integration test is a simple master-detail application which has a master view controller with a table and a detail view controller with an IcedCoffee view. For storyboards, things should work the same way basically.

In order to get things going with IB, you must create a custom subclass of ICGLView, even if that doesn't do anything. Interface Builder for some reason won't accept ICGLView itself as a valid UIView subclass, which appears to me as being an Apple bug. Look at the integration test for a working example.

Also, in the development branch I changed ICGLView's -initWithCoder: method to create the correct depth/stencil buffer (GL_DEPTH24_STENCIL8_OES). The depth buffer test in the master branch is also wrong. It was only creating a depth buffer, so I also changed this to GL_DEPTH24_STENCIL8_OES.

Tobias

Tobias

Hi, I have checked out the developer branch, but the IBIntegrationTest has multiple compile errors.

Use of undeclared identifier '_masterPopoverController'
Use of undeclared identifier '_window'
Unknown receiver '_navigationController'; did you mean 'UINavigationController'?
Unknown receiver '_splitViewController'; did you mean 'UISplitViewController'?
Unexpected '@' in program

I have patched locally by synthesising the properties and commenting out the iPad sections as I am testing on iPhone.

I have run the test and see the master detail at work, I am going to try and integrate the developer branch with my Storyboard.

With the master branch and using a single view controller in my test storyboard, I can get the view to render but I can not get the touch events/picking/dragging to work.

Andy

Tobias

On a side note, when I'm in iced coffee in Xcode IDE, if I jump to the definition of ICGLVew.h it takes me to the MAC version, even if I start from the IOS projects.

I wondered if this was related to you issue with using ICGLView with the XIB.

In my main project I only have the IOS headers included and had no issues in Storyboard using that class directly

Andy, I assume the compile errors you got originate from me using the newest Xcode (4.4) with iOS 5.1. It appears as if they changed some templates and subclasses there. I think it's completely OK if you remove the stuff you don't need there.

Regarding the event handling: yes, it didn't work. There were two problems:

  1. In ICHostViewControllerIOS -initWithNibName:bundle: was missing. So the controller didn't create a touch event dispatcher. This is fixed now, though it's not beautiful to repeat the initializer's code (we'll change that later).
  2. In DetailViewController.m (IBIntegrationTest) I forgot to wire the view to the view controller. ICGLView needs to know its corresponding host view controller for event handling.
- (void)viewDidLoad
{
    [super viewDidLoad];

    // Issue #3: wire view to host view controller when created via nib
    ((ICGLView *)self.view).hostViewController = self;

    // Do any additional setup after loading the view, typically from a nib.
    [self configureView];
}

I fixed both issues and pushed an update to the development branch. Hope it works now!

Tobias

Following up on your side note: yes, Xcode doesn't handle this well. Unfortunately, for me it was not even working when using the isolated icedcoffee-tests-ios Xcode project. Interface Builder was just beeping when I entered the ICGLView class name in the inspector. Good to hear that it worked for you. It would be nice if users wouldn't have to subclass the view just to integrate with IB. I will try again and see whether I get it working on one of my other machines.

Tobias

Hi, I have a local fix for Storyboard issue I had where the view was being passed as UIView all the time.

The problem is the setView method on the ICHostViewController, this seems to play havoc with the Storyboard lifecycle methods.

I changed

  • (void)setView:(UIView *)view;

to

-(void)viewDidLoad;

This allows the lifecycle methods to behave as normal and notify us once the view is loaded, in the viewDidLoad method the view is referenced by self.view.

I now have the same rendering only state that I had before with the XIB test example, so I will need to pick up your other changes to support dragging.

I'll wait for your response as to whether this local fix will break anything else or is the right way forward.

Here is the apple reference I used for controller/view lifecycle

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

Andy

Tobias

Hi, I should have included my viewDidLoad impl:

-(void)viewDidLoad
{

//#ifdef __IC_PLATFORM_IOS
// NSLog(@"calling super setview");
// [super setView:view];
//#endif
// Mac SDK doesn't know view controllers, so ICHostViewControllerMac implements this
// in its own subclass

if (self.view) {

    // OpenGL context became available: if the view's OpenGL context doesn't have a corresponding
    // render context yet, create and register a new render context for it, so it's possible
    // for other components to retrieve it via the OpenGL context globally
    ICContextManager *contextManager = [ICContextManager defaultContextManager];
    _renderContext = [contextManager renderContextForOpenGLContext:[self openGLContext]];
    if (!_renderContext) {
        _renderContext = [[ICRenderContext alloc] init];
        [contextManager registerRenderContext:_renderContext
                             forOpenGLContext:[self openGLContext]];
    }

    // If not already existing, create a texture cache bound to our OpenGL context
    // (required for auxiliary OpenGL context)
    if (!self.textureCache) {
        _renderContext.textureCache = 
            [[[ICTextureCache alloc] initWithHostViewController:self] autorelease];
    }

    [self setupScene];
}

}

Hi Andy, I think the lifecycle issue is related to Apple's way of handling the view's instantiation. They seem to use loadView if the controller's view property is nil, which in turn calls viewDidLoad once the view has loaded. IcedCoffee currently does it differently, by instantiating the view itself and then setting it on the controller. However, it's quite interesting that this seems to work in the IBIntegrationTest case, but does not in your storyboard case.

Your solution looks OK to me as a local fix, but most likely will break programmatic view/view controller lifecycle management as it is implemented now in IcedCoffee. What is more, it is prone to break once we update the framework with a generic fix for the issue.

I suggest that I change ICHostViewControllerIOS/ICHostViewController w.r.t. the Apple docs about managing the view lifecycle in UIViewController. Then, it would be great if you could test whether the changed version works in your setup. I will also create another test case using a storyboard in order to reproduce the issue more precisely.

If it's OK for you, just use your local fix to be workable with IcedCoffee. Then later, you can pull the framework fix and discard your local fix as soon as it works correctly.

Tobias

Tobias

Hi, yes agreed, I have enough to be able to focus on generating the content of the view, as soon as you have a build you would like me to test let me know and I'll integrate and test it.

Andy, I gave it a quick try, just pushed it to the development branch. I redesigned the host view controllers to follow the Apple pattern and added some magic to not break the old style ICGLView instantiation that's still quite common in the current framework test cases. This works for me at least in the IBIntegrationTest case and for all existing tests. I didn't have the time to test it with a storyboard yet. Perhaps you are faster than me in trying the integration.

Short wrap-up:

  1. ICHostViewController now implements -isViewLoaded, -loadView, and -viewDidLoad.
  2. In the case of an IB integration the only thing you have to do now is to wire the view to the host view controller after calling the super method like so:
- (void)viewDidLoad
{
    [super viewDidLoad];
    ((ICGLView *)self.view).hostViewController = self;
    /// .. configure view and so on
}

(See also DetailViewController.m in IBIntegrationTest.)

  1. The context management and texture cache stuff is then done for you in ICHostViewController -viewDidLoad.

The future way of instantiating views programatically will be via -loadView in a custom host view controller. We will completely transition away from the old way of creating the view in the AppDelegate so as to make this is a clean solution for everyone. A thing that needs to be fiddled out is the Mac Interface Builder integration. I am going to look into this next week.

Just let me know whether it works, and if not, where it crashes. Thank you!

PS: The files to migrate are:

  • ICHostViewController.h
  • ICHostViewController.m
  • Platforms/Mac/ICGLView.m
  • Platforms/Mac/ICHostViewControllerMac.h
  • Platforms/Mac/ICHostViewControllerMac.m
  • Platforms/iOS/ICGLView.m

Andy, one more thing: I think we are going to move the host view controller/view wiring to the host view controller super class with the next commit. I will let you know when the line from my previous comment will no longer be required.

Tobias

Hi, I took a fresh git clone, checked out the development branch, built the iOS binary, copied it over to my project, I brought the
ICHostViewController.h file over to my project.

Recompiled my App and I now have both the storyboard view and the airplay view (it stopped rendering the scene with my local patch) rendering. So it's looking good so far, I do need to figure out what I need to pick up to get dragging working again, but I'll wait until these changes are complete.

I appreciate the time you have taken out to fix this, I do think it will make it much easier for new developers to pick up the framework and run with it. One of the reasons I rejected a number of the mature OpenGL games engines was their insistence on taking over the whole App rather than being a component that can play nice with the rest of the App.

Andy

What do you mean with "get dragging working again"? Is event handling working for you in this configuration? I probably didn't fully understand what you mean.. :) Just let me know if there's something still going wrong on the framework side.

Thank you for investing so much time to get it work. It's very valuable to us. By the way: I fully share your opinion w.r.t. ease of integration. That's the reason minimalism is one of the top priorities of IcedCoffee. Most frameworks simply are too monolithic to provide for that. And it turns out it's one of the hardest parts in writing a good framework.

Tobias

Tobias

Hi, A few posts back you mentioned that I had to make a change to fix dragging in the multi touch test code I have copied to test the initial integration. I have not done that yet, so I'm making an assumption that this is the reason the dragging is not working in my App.

But I'll run the test app standalone then copy the latest code over and make sure it is working, I'll let you know if I have any problems.

Andy

The reason it (event handling) wasn't working was ICHostViewControllerIOS not implementing -initWithNibName:bundle: plus the missing wiring (assigning host view controller to view). This should be fixed as of commit 0d3f919. If it doesn't work for you, please let me know. I only tested it with a button in IBIntegrationTest and it seems to work there.

Tobias

Tobias

Hi, I have just run up the latest multitochspritestest before porting over to my App,

I notice that, the first five touches regiter and I can drag all items, but If I add a sixth touch then the dragging stops until I take my fingers off and start again.

I can't see any touch limits but is there a limit to the number of touches tracked, is this in iOS or in iced coffee? would you rather I open a new issue for this?

Andy

Tobias

Hi, I have updated my code and the dragging is not working.

I have created a subclass of ICHostViewControlleriOS and I have added the following code taken from the multitouchspritetest

  • (void)viewDidLoad
    {

    [super viewDidLoad];
    // Do any additional setup after loading the view.

    ((ICGLView *)self.view).hostViewController = self;

    [((ICGLView *)self.view) setMultipleTouchEnabled:YES];

    [self enableRetinaDisplaySupport:YES];

    ICScene *scene = [ICScene scene];

    NSString *filename = [[NSBundle mainBundle] pathForResource:@"thiswayup" ofType:@"png"];
    ICTexture2D *texture = [[ICTextureCache currentTextureCache] loadTextureFromFile:filename];

    for (int i=0; i<10; i++) {
    DraggableSprite *s = [DraggableSprite spriteWithTexture:texture];
    [s setPosition:kmVec3Make(arc4random() % 300, arc4random() % 400, 0)];
    [scene addChild:s];
    }

    [self runWithScene:scene];
    }

I saw that MultiTouch was not enabled in the storyboard for the UIView object, I enabled that but it did not help.

Is there a way to tell if the touch events are making it through to the framework?

Andy

Regarding the first issue, please open a new issue. I am not sure about this. I didn't test it yet with so many touches. Both frameworks may be responsible though I cannot imagine why IcedCoffee should impose a limit on the number of touches.

Regarding the second issue: please first check whether you correctly assign the host view controller to the view. This is the most common problem. If the view has a nil hostViewController property it won't dispatch any native events to the framework.

Then, you might check whether events are dispatched by opening ICGLView.m via Finder (so it is opened up in Xcode), then set a breakpoint at line 335 (in internalTouchesBegan:). Open ICHostViewControllerIOS.m and set a breakpoint at line 202 (in touchesBegan). See if both breakpoints are being hit. This should work even if you are using the prebuilt framework archive.

If you find that ICHostViewControllerIOS -touchesBegan: is not being called, that's most likely because the view has its hostViewController property set to nil. In this case, check back whether you wired it correctly. If the second breakpoint is hit, check whether _touchEventDispatcher is nil. If that is nil, something went wrong with my code updates for your case. If it is non-nil, everything should work correctly. If it does not though, we have to go on...

Hope this helps!

Tobias

Andy, I added some debug logging to both ICGLView and ICHostViewControllerIOS.

There is an NSLog now in ICGLView that fires when the view's hostViewController property is set to nil and a touch event is received by the view. This will appear always no matter whether you specify debugging flags or not.

Additionally, I added some more decent ICLog messages to ICHostViewControllerIOS and ICGLView. They are activated if you set IC_ENABLE_DEBUG_TOUCH_DISPATCHER to 1 in icConfig.h. Also, you need to specify ICEDCOFFEE_DEBUG=1 as a preprocessor macro, which is the default for icedcoffee-ios.xcodeproj in debug mode (see the build settings). If activated, you should see debug messages for both ICGLView and ICHostViewControllerIOS. If everything works correctly, you will also see debug messages for the rest of the touch dispatcher. If that still doesn't suffice, you can also activate IC_ENABLE_DEBUG_HITTEST by setting it to 1. And finally, IC_ENABLE_DEBUG_PICKING (which really spams the console with details if it gets there). However, I doubt there is a problem with the last two.

Tobias

Tobias

Hi, I have not managed to get the breakpoints to work in the iced coffee .m files, I'll have another look tomorrow.

I have enabled logging:

// Output debug log messages to console for hit test results
#ifndef IC_ENABLE_DEBUG_HITTEST
#define IC_ENABLE_DEBUG_HITTEST 1
#endif

// Output debug log messages to console when picking is being performed
#ifndef IC_ENABLE_DEBUG_PICKING
#define IC_ENABLE_DEBUG_PICKING 1
#endif

// Output debug log messages to console when dispatching touch events (iOS only)
#ifndef IC_ENABLE_DEBUG_TOUCH_DISPATCHER
#define IC_ENABLE_DEBUG_TOUCH_DISPATCHER 1
#endif

And set the PREPROCESSOR ICEDCOFFEE_DEBUG=1 property

I now see the following in the log:

2012-08-05 23:57:10.855 IntellAgent[7126:707] Host view received touchesBegan:withEvent:
2012-08-05 23:57:10.866 IntellAgent[7126:6803] Host view controller received touchesBegan:withEvent:
2012-08-05 23:57:10.988 IntellAgent[7126:707] Host view received touchesEnded:withEvent:
2012-08-05 23:57:11.000 IntellAgent[7126:6803] Host view received internalTouchesEnded:
2012-08-05 23:57:11.006 IntellAgent[7126:6803] Host view controller received touchesEnded:withEvent:
2012-08-05 23:57:11.124 IntellAgent[7126:707] Host view received touchesBegan:withEvent:
2012-08-05 23:57:11.130 IntellAgent[7126:6803] Host view controller received touchesBegan:withEvent:
2012-08-05 23:57:11.199 IntellAgent[7126:707] Host view received touchesEnded:withEvent:
2012-08-05 23:57:11.210 IntellAgent[7126:6803] Host view received internalTouchesEnded:
2012-08-05 23:57:11.216 IntellAgent[7126:6803] Host view controller received touchesEnded:withEvent:
2012-08-05 23:57:17.173 IntellAgent[7126:707] Host view received touchesBegan:withEvent:
2012-08-05 23:57:17.181 IntellAgent[7126:6803] Host view controller received touchesBegan:withEvent:
2012-08-05 23:57:17.294 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.309 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.303 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.312 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.325 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.330 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.340 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.348 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.356 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.362 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.375 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.379 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.388 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.395 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.405 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.411 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.420 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.427 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.436 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.443 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.452 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.459 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.468 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.475 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.486 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.501 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.496 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.511 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.517 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.533 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.528 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.541 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.549 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.558 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.565 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.574 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.582 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.591 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.596 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.608 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.612 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.628 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.625 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.639 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.645 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.655 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.660 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.671 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.676 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.686 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.692 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.702 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.708 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:17.715 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:17.772 IntellAgent[7126:707] Host view received touchesEnded:withEvent:
2012-08-05 23:57:17.776 IntellAgent[7126:6803] Host view received internalTouchesEnded:
2012-08-05 23:57:17.780 IntellAgent[7126:6803] Host view controller received touchesEnded:withEvent:
2012-08-05 23:57:26.372 IntellAgent[7126:707] Host view received touchesBegan:withEvent:
2012-08-05 23:57:26.383 IntellAgent[7126:6803] Host view controller received touchesBegan:withEvent:
2012-08-05 23:57:29.158 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.162 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.174 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.178 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.190 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.194 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.207 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.210 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.222 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.226 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.238 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.242 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.254 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.259 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.270 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.275 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.286 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.291 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.303 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.318 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.313 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.326 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.334 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.339 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.350 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.358 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.369 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.379 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.383 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.393 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.399 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.415 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.409 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.423 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.431 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.439 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.446 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.455 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.462 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.469 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.478 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.487 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.494 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.499 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.510 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.515 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.526 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.530 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.542 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.545 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.558 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.562 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.574 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.578 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.590 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.593 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:29.606 IntellAgent[7126:707] Host view received touchesMoved:withEvent:
2012-08-05 23:57:29.610 IntellAgent[7126:6803] Host view controller received touchesMoved:withEvent:
2012-08-05 23:57:30.487 IntellAgent[7126:707] Host view received touchesEnded:withEvent:
2012-08-05 23:57:30.493 IntellAgent[7126:6803] Host view received internalTouchesEnded:
2012-08-05 23:57:30.498 IntellAgent[7126:6803] Host view controller received touchesEnded:withEvent:

Andy

Tobias

Just to confirm I do not see the warning regarding null hostviewcontroller

Andy

This looks as if the host view controller didn't create its touch event dispatcher. Probably, because the wrong initializer was called, or the correct initializer is missing.

Make sure ICHostViewControllerIOS.m contains the following initializer:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        _touchEventDispatcher = [[ICTouchEventDispatcher alloc] initWithHostViewController:self];
    }
    return self;
}

- initWithNibName:bundle: is the initializer that should be called when instantiating the host view controller via nib files, as is the case with your storyboard. So if it is implemented, I don't see any reason why it should not be called. The scenario is basically the same as with IBIntegrationTest. There, I could verify that -initWithNibName:bundle is in fact being called.

Tobias

Andy, I have added another couple of log messages. If you activate IC_ENABLE_DEBUG_HOSTVIEWCONTROLLER in icConfig.h, it should output a debug message telling you which initializer of your ICHostViewControllerIOS subclass is being called. If there is no debug message at the very beginning of the output in the form "2012-08-06 01:14:34.120 IBIntegrationTest[2230:c07] DetailViewController initialized via initWithNibName:bundle:", there probably is something wrong with the initialization of your subclass.

Additionally, I added an NSLog message which fires if the host view controller doesn't have a valid touch event dispatcher for dispatching events into the framework. This again fires regardless of how you configure debugging. If you see a message like "No touch event dispatcher available in ", then we can verify that this is the problem.

Tobias

Tobias

Hi, I have pulled and run the latest developer branch, I did then see the "No touch event dispatcher available in " messages.

Looking at the ISHostViewControllerIOS I saw that there was no initWithCoder initialiser, I believe Storyboard uses this initialiser rather than the NIB initialiser, so I added the following method and now the touch events are working again!

Andy

  • (id)initWithCoder:(NSCoder *)aDecoder
    {
    if( (self = [super initWithCoder:aDecoder]) ) {
    _touchEventDispatcher = [[ICTouchEventDispatcher alloc] initWithHostViewController:self];
    }

    return self;
    }

Andy, I was suspecting something like that. Sorry for that, I missed the -initWithCoder: initializer. Great to hear that it works now. I will merge this into the ICHostViewControllerIOS.m in the development branch.

Thank you!

Tobias

Andy, I have added the -initWithCoder: initializer to ICHostViewControllerIOS in the development branch. Would be nice if you could give me some feedback whether it works for you this way. Big thanks!

Tobias

Tobias

Hi, I have built the latest dev branch, pulled in just the binary to my project (no new headers). cleaned/ built and it appears to run without issue.

As a side question are you monitoring the google group yet, I asked a (low priority) question there but it does not appear to have had any views.

On other projects, I normally ask the initial question on the group and then escalate to github issue if it's deemed to be a bug or feature request.

Cheers

Andy

On 11 Aug 2012, at 13:34, Tobias Lensing wrote:

Andy, I have added the -initWithCoder: initializer to ICHostViewControllerIOS in the development branch. Would be nice if you could give me feedback whether it works for you this way. Big thanks!

Tobias


Reply to this email directly or view it on GitHub.

Great to hear that it works for you.

Sorry for not answering the group question. I forgot to configure my google mail account to forward mails to my main account. It's perfect to use the group before posting an issue, and I'll be responsive there from now on.

Tobias

There was another issue: the alternative initializers (of course) didn't call -init of the super class (ICHostViewController). I changed them all to use commonInit. The subclasses' commonInit methods do now call [super commonInit] to ensure that the basic platform-independent stuff (scheduler, target-action dispatcher, and so on) is initialized correctly.

This should be the last fix before this can go into the next release, unless you tell me it isn't working for you.

Tobias

Tobias

Hi, I have built the latest dev branch and copied over just the .a binary, cleaned and rebuilt my App. It appears to run without error.

Andy