我的应用程序使用两种语言并具有三个选项卡。我的应用程序中有一个语言更改按钮,每当更改所有选项卡的标题时,都必须根据语言更改。这是我使用的代码,它在 iPad 中运行良好,但相同的代码在 iPhone 中崩溃。这两个设备都是在 iOS5 中。
viewController1 = [[MapFirstViewController alloc] initWithNibName:@"MapFirstViewController_iPad" bundle:nil];
viewController1.tabBarItem = [[UITabBarItem alloc] initWithTitle:[self languageSelectedStringForKey:@"about"] image:[UIImage imageNamed:@"about_tabbar_icon.png"] tag:8];
viewController2 = [[MapSecondViewController alloc] initWithNibName:@"MapSecondViewController_iPad" bundle:nil];
viewController2.tabBarItem= [[UITabBarItem alloc] initWithTitle:[self languageSelectedStringForKey:@"Map"] image:[UIImage imageNamed:@"maps_tabbar_icon.png"] tag:9];
viewController3 = [[ViewListIpad alloc] initWithNibName:@"ViewListIpad" bundle:nil];
viewController3.tabBarItem= [[UITabBarItem alloc] initWithTitle:[self languageSelectedStringForKey:@"eKiosks & eSC List"] image:[UIImage imageNamed:@"esc&kiosk_tabbar_icon.png"] tag:10];
MapAppDelegate *appDelegate = (MapAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray *viewControllersArray = [NSMutableArray arrayWithArray:[[appDelegate tabBarController] viewControllers]];
[viewControllersArray replaceObjectAtIndex:0 withObject:viewController1];
[viewControllersArray replaceObjectAtIndex:1 withObject:viewController2];
[[appDelegate tabBarController] setViewControllers:viewControllersArray animated:NO];
崩溃日志:
Thread 0 crashed with ARM Thread State:
r0: 0x00000004 r1: 0x00000000 r2: 0x00000001 r3: 0x00000001
r4: 0x0000000a r5: 0x00000000 r6: 0x00000000 r7: 0x2fef4da4
r8: 0x00235970 r9: 0x00000000 r10: 0x0010a710 r11: 0x2fef4dd4
ip: 0x0000014e sp: 0x2fef4d6c lr: 0x364beff9 pc: 0x375e1628
cpsr: 0x20000010
Binary Images:
0xf6000 - 0x107fff ReportCrash armv7 <8c18758965fb30d6ac04b1e0cddc8fda> /System/Library/CoreServices/ReportCrash
0x2fef5000 - 0x2ff16fff dyld armv7 <be7c0b491a943054ad12eb5060f1da06> /usr/lib/dyld
0x30bcb000 - 0x30bd7fff libCRFSuite.dylib armv7 <ea460e3f1ac338a9885d5752864dbffb> /usr/lib/libCRFSuite.dylib
0x31384000 - 0x31384fff libunwind.dylib armv7 <d21222aad8c93d6c9580f9bf47071946> /usr/lib/system/libunwind.dylib
0x31a98000 - 0x31a9bfff libmacho.dylib armv7 <3237bc9c109e3354bc4b38b957243f31> /usr/lib/system/libmacho.dylib
0x31c17000 - 0x31c34fff libsystem_info.dylib armv7 <1e36ab94661c372bab5a801d68c79353> /usr/lib/system/libsystem_info.dylib
0x31c4a000 - 0x31c59fff GenerationalStorage armv7 <c581bffc87013530b3c2d017142395e6> /System/Library/PrivateFrameworks/GenerationalStorage.framework/GenerationalStorage
0x31c5a000 - 0x31d07fff libxml2.2.dylib armv7 <78462273eb5b38d1a0873b02f0e35e23> /usr/lib/libxml2.2.dylib
0x31d08000 - 0x31d44fff AppSupport armv7 <de0c2fbb95f8383db43acfb44e9c66fe> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x31d47000 - 0x31d4dfff MobileKeyBag armv7 <f5633749a1c83058a28cd7d0b488e19f> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x31d6b000 - 0x31d6dfff MobileInstallation armv7 <4ccf76f0e6cb3cd7b4e0087c2f284a1d> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x31d6e000 - 0x31d7ffff libxpc.dylib armv7 <7d49e385ee5d3e7eb08d06525abd6435> /usr/lib/system/libxpc.dylib
0x31fcf000 - 0x32095fff libobjc.A.dylib armv7 <ebbb32df194b331e9b3dc14e40f46833> /usr/lib/libobjc.A.dylib
0x3247f000 - 0x324b7fff CoreSymbolication armv7 <6cc5037406113e98ab665e5edab27a54> /System/Library/PrivateFrameworks/CoreSymbolication.framework/CoreSymbolication
0x32884000 - 0x32887fff libsystem_network.dylib armv7 <b18e0a845b1e317c8abcf6b5d06b29a0> /usr/lib/system/libsystem_network.dylib
0x329db000 - 0x329dbfff libkeymgr.dylib armv7 <791bb8b832943b2392c0c35228f52e09> /usr/lib/system/libkeymgr.dylib
0x32eb9000 - 0x33037fff Foundation armv7 <ce466f428d953caaac6641d186665809> /System/Library/Frameworks/Foundation.framework/Foundation
0x330e7000 - 0x3322cfff CoreGraphics armv7 <641fb6e558f239588a8bd05dbefff99a> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x3322d000 - 0x3326afff IOKit armv7 <e5f727892ee034a4be04e6da608f413f> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x33289000 - 0x332ccfff libcommonCrypto.dylib armv7 <be9a231cfe6e3ae387abb444a098bce9> /usr/lib/system/libcommonCrypto.dylib
0x333fc000 - 0x333fdfff libsystem_blocks.dylib armv7 <4bb9797771d037879bec814fe750d86d> /usr/lib/system/libsystem_blocks.dylib
0x33596000 - 0x33596fff liblangid.dylib armv7 <342170169bf232a0888912f5ef97112d> /usr/lib/liblangid.dylib
0x335af000 - 0x335cefff libSystem.B.dylib armv7 <31a0ffbb18bf3a28b46fd286733e7d9f> /usr/lib/libSystem.B.dylib
0x3368e000 - 0x336d8fff CoreTelephony armv7 <1f4cacb552533c948122cb180f4192b3> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x3378c000 - 0x337c3fff Security armv7 <b89c9f6373f037f2a4801558f97b9a95> /System/Library/Frameworks/Security.framework/Security
0x339ba000 - 0x339bbfff libremovefile.dylib armv7 <9c8cee9652453241ac1fc99eab05c40a> /usr/lib/system/libremovefile.dylib
0x33afd000 - 0x33b00fff libcompiler_rt.dylib armv7 <414332f9a55238bab2cbec323e0fc8da> /usr/lib/system/libcompiler_rt.dylib
0x33eee000 - 0x33ef7fff libMobileGestalt.dylib armv7 <bf8d7c30f11a393a8adf4c8277e65aa3> /usr/lib/libMobileGestalt.dylib
0x33efd000 - 0x34014fff CoreFoundation armv7 <de9eefc6109735369cfd8f3de9895da0> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x3401d000 - 0x3406efff libstdc++.6.dylib armv7 <dc2061145c1a3307829d4f3bfc547c1a> /usr/lib/libstdc++.6.dylib
0x3406f000 - 0x34070fff libsystem_sandbox.dylib armv7 <b8612b4ce18535aaa94f4b75c730e090> /usr/lib/system/libsystem_sandbox.dylib
0x34071000 - 0x34076fff CrashReporterSupport armv7 <c3062554536438f9874c88363df7f60b> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport
0x3407b000 - 0x340fafff libsqlite3.dylib armv7 <af4718fee01734748c42f2214ab6883d> /usr/lib/libsqlite3.dylib
0x348c7000 - 0x348cdfff liblockdown.dylib armv7 <bfaf7fb16e5a3b2ea07c47b8b2f2b64e> /usr/lib/liblockdown.dylib
0x348ce000 - 0x348cffff libdnsinfo.dylib armv7 <dbd1e77a4beb309d8f160d927d442467> /usr/lib/system/libdnsinfo.dylib
0x351de000 - 0x351dffff libdyld.dylib armv7 <f1963e7ef64e39a58ec1e39ed7c74849> /usr/lib/system/libdyld.dylib
0x35219000 - 0x3521efff libcopyfile.dylib armv7 <9072462f28af3665875b3ecaba002c00> /usr/lib/system/libcopyfile.dylib
0x35269000 - 0x35273fff libbz2.1.0.dylib armv7 <28583efb9f1b38e7ae83c667b07dbd08> /usr/lib/libbz2.1.0.dylib
0x3530b000 - 0x35317fff libz.1.dylib armv7 <eef915ed9b2c3433b03fd9030957b945> /usr/lib/libz.1.dylib
0x35318000 - 0x3534dfff SystemConfiguration armv7 <753be0ebdcb13b24b1a4adcdc94d6bd9> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x354e5000 - 0x3562efff libicucore.A.dylib armv7 <1bc960f75d633190a09b093209a9f0c5> /usr/lib/libicucore.A.dylib
0x356b5000 - 0x356b5fff libgcc_s.1.dylib armv7 <69d8dab7388b33d38b30708fd6b6a340> /usr/lib/libgcc_s.1.dylib
0x3584b000 - 0x35852fff libc++abi.dylib armv7 <f769ce305c3033ee90e8c2ecc4846619> /usr/lib/libc++abi.dylib
0x35886000 - 0x3588bfff libsystem_dnssd.dylib armv7 <4d8b38f1cb603f0d8af78c56c485f05a> /usr/lib/system/libsystem_dnssd.dylib
0x35c7b000 - 0x35d52fff CFNetwork armv7 <6fbc9f187eaa30009780e70288c9f289> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x36456000 - 0x3645cfff liblaunch.dylib armv7 <09f21c3e774c30b1aab1b56c2d6efbc3> /usr/lib/system/liblaunch.dylib
0x364ab000 - 0x36538fff libsystem_c.dylib armv7 <1707c3cf3c5b3045af4bed38ff8420a6> /usr/lib/system/libsystem_c.dylib
0x36827000 - 0x3683dfff libdispatch.dylib armv7 <defe319d1f4d3c1c8c4f18ebd96b396a> /usr/lib/system/libdispatch.dylib
0x36849000 - 0x36899fff Symbolication armv7 <e13514b900053efba4b9a43ed28359e5> /System/Library/PrivateFrameworks/Symbolication.framework/Symbolication
0x36e45000 - 0x36e4bfff libnotify.dylib armv7 <1e374857ac68370095ddbafe94f021a1> /usr/lib/system/libnotify.dylib
0x37079000 - 0x3707dfff libcache.dylib armv7 <4511f0ec5b713636aaade7245a12553c> /usr/lib/system/libcache.dylib
0x375d0000 - 0x375e6fff libsystem_kernel.dylib armv7 <afd3cb06e20336dca2e5a6e11d080504> /usr/lib/system/libsystem_kernel.dylib
0x37816000 - 0x37839fff Bom armv7 <0e6087f75a81345ea81751197ccb712c> /System/Library/PrivateFrameworks/Bom.framework/Bom