Frage

Die UITabBarController nicht im Querformat ermöglichen. Also habe ich eine Unterklasse von UITabBarContoller (genannt RotatingTabBarController) verwendet. Ihr einziger Zweck es eine Drehung zu ermöglichen, von JA zu ShouldAutorotateToInterfaceOrientation Anruf zurück.

Das Problem ist, dass, wenn Sie das iPhone in Simulator drehen sie die folgenden malloc Fehler geben.

malloc: *** error for object 0x3888000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Ich bin mit 3.0 SDK mit Xcode 3.2 auf Snow Leopard. Ich habe einen Haltepunkt in malloc_error_break aber ich kann es nicht zu meinem Code zurückverfolgen. Gibt es etwas, was ich tun kann, diesen Fehler zu machen, gehen Sie weg?

Hier ist die RotatingTabBarController Klasse:

#import <UIKit/UIKit.h>
@interface RotatingTabBarController : UITabBarController {
}
@end 

@implementation RotatingTabBarController
-(BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation {
    return YES;
}
@end

Update:

habe ich versucht, das gleiche mit einer Kategorie. Aber es gibt die gleichen malloc Fehler.

// UITabBarController+Rotation.h
@interface UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end

// UITabBarController+Rotation.m
#import "UITabBarController+Rotation.h"

@implementation UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   return YES;
}
@end

Backtrace

[Session started at 2009-09-05 12:13:19 -0400.]
Untitled(992,0xa06d9500) malloc: *** error for object 0x2024000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Untitled(992,0xa06d9500) malloc: *** error for object 0x2014000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

[Session started at 2009-09-05 12:13:27 -0400.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul  3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 992.
sharedlibrary apply-load-rules all
(gdb) bt
#0  0x951908fa in mach_msg_trap ()
#1  0x95191067 in mach_msg ()
#2  0x30244d62 in CFRunLoopRunSpecific ()
#3  0x30244628 in CFRunLoopRunInMode ()
#4  0x32044c31 in GSEventRunModal ()
#5  0x32044cf6 in GSEventRun ()
#6  0x309021ee in UIApplicationMain ()
#7  0x00002608 in main (argc=1, argv=0xbfffef94) at /Users/vishwas/Desktop/Untitled/main.m:13
(gdb) 
War es hilfreich?

Lösung

Dies ist ein Fehler in iPhone SDK 3.0. Es ist fest in iPhone SDK 3.1

Andere Tipps

Subclassing UITabBarController ist keine empfohlene Methode, Schnittstelle Rotation zu erhalten. In der Tat streng Apples Dokumentation sagt nicht zu Unterklasse entweder UITabBarController oder UINavigationController. Er sagt auch, dass für UITabBarController zu Unterstützung der Autorotation, alle Controller ‚verwaltet‘, indem sie diese Orientierung unterstützen müssen (das heißt Landschaft in diesem Fall).

Dieser Fehler sieht aus wie etwas, entweder ohne alloc / init freigegeben wird, oder es wird doppelt freigegeben, sieht nicht wie ein Fehler in Ihrem Unter classing oder Code.

I wie Kevlar Kategorie Ansatz Ihr Problem zu lösen, es ist kreativ, einfach, und sollte für Sie arbeiten.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top