appunite / CLCascade

Twitter-like cascade UI library
http://appunite.com/
Other
504 stars 67 forks source link

Crash when using IPA compiled file #37

Open damjancvetan opened 12 years ago

damjancvetan commented 12 years ago

Hello

My AP is running fine when I run it over XCode "Build & Run", but when I create IPA file and install it on iPad over iTunes it crash on swiping panels.

I even create IPA file of an Example Cascade code and AP crash immediately after I run it. I'm running it on iOS 5.

Did anyone ever experience something like that?

kwojtaszek commented 12 years ago

Can you share crash log with dSYM file

Regards, Karol

damjancvetan commented 12 years ago

Of course. This crash report http://db.tt/vYT1b9N9 is the latest. I created new IPA compiled file from Cascade example code. I have the same exception type with my AP.

lorenzopino commented 12 years ago

I have the same problem. When I build the IPA for Ad-Hoc distribution I have a lot of crashes. I was able to replicate the problem setting build configuration to "release" in the simulator Run configuration in the schema manager. I have an EXC_BAD_ACCESS in hitTest method of the class CLCascadeView [at the row "while ((item = [enumerator nextObject]))".

            - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
                id item = nil;
                // create enumerator
                NSEnumerator* enumerator = [self.pages reverseObjectEnumerator];
                // enumarate pages
                UIView *view = nil;

                while ((item = [enumerator nextObject])) {
                    if (item != [NSNull null]) {

                        UIView* page = (UIView*)item;
                        CGRect rect = [_scrollView convertRect:page.frame toView:self];

                        if (CGRectContainsPoint(rect, point)) {
                            CGPoint newPoint = [self convertPoint:point toView:page];
                            view = [page hitTest:newPoint withEvent:event]; break;
                        }
                    }
                } 

                // bug fix: @YuriSarkisyan
                if (view != nil) {
                    return view;
                }

                return [super hitTest:point withEvent:event];
            }

Activating NS_Zombie, in the console I have the following error:

*\ -[CLSegmentedView retain]: message sent to deallocated instance 0x6d861f0

YuriSarkisyan commented 12 years ago

damjancvetan. change build type of run schema from debug(default value) to release. For archive schema default is release.

YuriSarkisyan commented 12 years ago

lorenzopino. Try to use zombie instruments to see retain/release history for that object

damjancvetan commented 12 years ago

I was able to setup instruments and now I can watch retain/release history for CLSegmentedView object.

What I have noticed is that if I keep opening table views as new detail view everything looks fine. New views are added from right (in landscape) and current view is pushed to the left. If I touch the right view (new one) and move it left or right application is working. But if I touch the left view the right one just disappear from the screen and I think that _pages array becomes empty.

I can see in Instruments that [CLCascadeView hitTest:withEvent:] it called multiplie times and each time retain count decreases.

If I look at the code and if I understand it right hitTest function return [super hitTest:point withEvent:event] and I believe it returns NIL at the end because point doesn't exist in any of the rectangles.

Here is the screen shoot: http://dl.dropbox.com/u/15147799/Cascade_Instruments-1.png

Anyone knows where is the function responsible for responding to user touch?

damjancvetan commented 12 years ago

Hi

After looking in this hitTest function if was something strange to me and a rewrite while loop so the whole function looks like this:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

  // create enumerator
  NSEnumerator* enumerator = [_pages reverseObjectEnumerator];
  UIView *view = nil;

  for (UIView *item in [enumerator allObjects]) {
    if(item != nil){
      CGRect rect = [_scrollView convertRect:item.frame toView:self];    
      if(CGRectContainsPoint(rect, point)){
        CGPoint newPoint = [self convertPoint:point toView:item];
        view = [item hitTest:newPoint withEvent:event];
        break;
      }
    }
  }

  // bug fix: @YuriSarkisyan
  if (view != nil) {
    return view;
  }

  return [super hitTest:point withEvent:event];
}

I think that problem was with object retain count and with function "nextObject" of NSEnumerator object.

This code is now working for me even with compiled IPA file. It's possible that problem exist elsewhere but this is working on my and even on the example code.

Please test it.

chirimoya commented 12 years ago

Hi @ all,

I had the same problem. Many thanks to @damjancvetan. His hitTest function works for me!

One additional info: It has something to do with the build settings "Optimization Level". If this property is something else then "None" my app crashes with the same errorr message as described above.

Regards