Can we share controll file in an univarsal (iPhone, iPad) Application? - iphone

I developed a univarsal application,(iPhone, iPad). But later I tried to make them sepret, so i copied my folder in another directory and then linked my iPhone's control file with iPad's XIBs, and delegated them with Outlets, (my controll file remained in the iPhone folder, i just link them in iPad), after it i removed iPhone XIBs from this folder.
Now my project is working properly, BUT only if I execute the iPhone version first(even from that different directory), and then execute my iPad version, coz it share's the build file of iPhone.
But when I try to execute it Initially (after deleting prior installed version from simulator), it doesn't work, as it terminate after throwing following exception.
2011-04-23 10:56:01.831 Tuscany[1837:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** Call stack at first throw:
(
0 CoreFoundation 0x01683be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x014785c2 objc_exception_throw + 47
2 CoreFoundation 0x0163c628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0163c59a +[NSException raise:format:] + 58
4 Foundation 0x000d6b12 -[NSURL(NSURL) initFileURLWithPath:] + 90
5 Foundation 0x000d6aa0 +[NSURL(NSURL) fileURLWithPath:] + 72
6 Tuscany 0x0003572c -[SplashScreenViewController readyPlayer] + 77
7 Tuscany 0x00035a62 -[SplashScreenViewController viewDidLoad] + 296
8 UIKit 0x003e865e -[UIViewController view] + 179
9 UIKit 0x0035e026 -[UIWindow addRootViewControllerViewIfPossible] + 51
10 UIKit 0x0035d511 -[UIWindow _setHidden:forced:] + 303
11 UIKit 0x0035d301 -[UIWindow _orderFrontWithoutMakingKey] + 50
12 UIKit 0x0a2ac110 -[UIWindowAccessibility(SafeCategory) _orderFrontWithoutMakingKey] + 56
13 UIKit 0x0035bfb5 -[UIWindow makeKeyAndVisible] + 39
14 Tuscany 0x00003205 -[AppDelegate_iPad application:didFinishLaunchingWithOptions:] + 1472
15 UIKit 0x0033b1fa -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
16 UIKit 0x0033d55e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
17 UIKit 0x00347db2 -[UIApplication handleEvent:withNewEvent:] + 1533
18 UIKit 0x00340202 -[UIApplication sendEvent:] + 71
19 UIKit 0x00345732 _UIApplicationHandleEvent + 7576
20 GraphicsServices 0x01ce3a36 PurpleEventCallback + 1550
21 CoreFoundation 0x01665064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x015c56f7 __CFRunLoopDoSource1 + 215
23 CoreFoundation 0x015c2983 __CFRunLoopRun + 979
24 CoreFoundation 0x015c2240 CFRunLoopRunSpecific + 208
25 CoreFoundation 0x015c2161 CFRunLoopRunInMode + 97
26 UIKit 0x0033cfa8 -[UIApplication _run] + 636
27 UIKit 0x0034942e UIApplicationMain + 1160
28 Tuscany 0x00002b30 main + 102
29 Tuscany 0x00002ac1 start + 53
)
terminate called after throwing an instance of 'NSException'
here to mention i have worked hard with the line i'm establishing connection, and as i told same code run properly when I execute iPhone version first and then the iPad.
so please guied me with this,
thank you

What it says.
In the readyPlayer method you are trying to give a nil value to the fileUrlWithPath method.
You need to check why the path is nil.

Related

How to compile for iPhone 4

here is my problem:
I have a fully working app which runs quite perfect on my iPhone 4S running iOS 5.1.1.
Now Apple rejected my app because they found that the app crashed upon launch on iPhone 4 running iOS 5.1.1. What do I have to do to compile for the iPhone 4? I can't really test it because I only have an iPhone 4S to my disposal. I already did some tweaking in the project settings and added armv6. What else do I have to do?
I symbolicated the crashreport I got from apple as you can see below.
However, the problem remains the same. I can not figure out why my app does not run on an iPhone 4. I found one piece of code that is mentioned as #6 of the last exceptions.
It is located in ViewController.m. This is my code at the specified line:
self.player =[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
Last Exception Backtrace:
0 CoreFoundation 0x3742088f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x35125259 objc_exception_throw + 33
2 CoreFoundation 0x37420789 +[NSException raise:format:] + 1
3 CoreFoundation 0x374207ab +[NSException raise:format:] + 35
4 Foundation 0x37c0805f -[NSURL(NSURL) initFileURLWithPath:] + 79
5 Foundation 0x37c07ffb +[NSURL(NSURL) fileURLWithPath:] + 43
6 Podman 0x00021feb -[ViewController viewDidLoad] (ViewController.m:43)
7 UIKit 0x3112dc8b -[UIViewController view] + 167
8 UIKit 0x3112c461 -[UIWindow addRootViewControllerViewIfPossible] + 45
9 UIKit 0x3111ee87 -[UIWindow _setHidden:forced:] + 295
10 UIKit 0x3118f7d5 -[UIWindow makeKeyAndVisible] + 25
11 UIKit 0x3112ce6d -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1633
12 UIKit 0x311267dd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 409
13 UIKit 0x310f4ac3 -[UIApplication handleEvent:withNewEvent:] + 1011
14 UIKit 0x310f4567 -[UIApplication sendEvent:] + 55
15 UIKit 0x310f3f3b _UIApplicationHandleEvent + 5827
16 GraphicsServices 0x33b3622b PurpleEventCallback + 883
17 CoreFoundation 0x373f4523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
18 CoreFoundation 0x373f44c5 __CFRunLoopDoSource1 + 141
19 CoreFoundation 0x373f3313 __CFRunLoopRun + 1371
20 CoreFoundation 0x373764a5 CFRunLoopRunSpecific + 301
21 CoreFoundation 0x3737636d CFRunLoopRunInMode + 105
22 UIKit 0x3112586b -[UIApplication _run] + 551
23 UIKit 0x31122cd5 UIApplicationMain + 1081
24 Podman 0x00021e7b main (main.m:16)
25 Podman 0x00021e30 start + 40

Why is my iPhone app crashing with the exception "Could not load NIB in bundle"?

I am learning how to make iPhone apps in the simulator but my app crashes as soon as it launches in the simulator. Also, there are no errors and no warnings when I compile the source code.
Here is a copy of the console logs -
2011-10-27 04:49:08.376 login[1192:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'LoginView''
* Call stack at first throw:
(
0 CoreFoundation 0x00dc85a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1c313 objc_exception_throw + 44
2 CoreFoundation 0x00d80ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d80e6a +[NSException raise:format:] + 58
4 UIKit 0x004b30fa -[UINib instantiateWithOwner:options:] + 2024
5 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
6 UIKit 0x0036a628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
7 UIKit 0x00368134 -[UIViewController loadView] + 120
8 UIKit 0x0036800e -[UIViewController view] + 56
9 login 0x000029c3 -[loginViewController viewDidLoad] + 165
10 UIKit 0x004b2f26 -[UINib instantiateWithOwner:options:] + 1556
11 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
12 UIKit 0x002ba17a -[UIApplication _loadMainNibFile] + 172
13 UIKit 0x002bacf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
14 UIKit 0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533
15 UIKit 0x002bdabf -[UIApplication sendEvent:] + 71
16 UIKit 0x002c2f2e _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x01720992 PurpleEventCallback + 1550
18 CoreFoundation 0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00d09cf7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00d06f83 __CFRunLoopRun + 979
21 CoreFoundation 0x00d06840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00d06761 CFRunLoopRunInMode + 97
23 UIKit 0x002ba7d2 -[UIApplication _run] + 623
24 UIKit 0x002c6c93 UIApplicationMain + 1160
25 login 0x00002694 main + 102
26 login 0x00002625 start + 53
)
terminate called after throwing an instance of 'NSException'
I have tried and tried and can't seem to fix this problem. I will appreciate any help.
Your app is trying to load a file called LoginView.xib, and failing to. Seems like this file is referenced from your MainWindow.xib (or whichever is your main nib file as defined in your application plist). Check that this file exists, is copied to the bundle (in the copy resources build phase). If that's the case you can try cleaning the project, restarting xCode and trying again (I had this problem occasionally, for no apparent reason when switching between iPhone/iPad targets).

terminate called after throwing an instance of 'NSException' (gdb)

I've made an app with 6 months of work with no backups. It works fine on Simulator but on device it crashes.
This is the error code:
2011-09-11 17:55:49.172 Apli[223:707] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle /var/mobile/Applications/FC234696-314B-4328-94BF-A73506B8AB07/Apli.app> (loaded)' with name 'MainWindow''
*** Call stack at first throw:
(
0 CoreFoundation 0x3438664f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x36879c5d objc_exception_throw + 24
2 CoreFoundation 0x34386491 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x343864cb +[NSException raise:format:] + 34
4 UIKit 0x34b03a53 -[UINib instantiateWithOwner:options:] + 1110
5 UIKit 0x34b04e09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
6 UIKit 0x3492f4cd -[UIApplication _loadMainNibFile] + 96
7 UIKit 0x34929b09 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
8 UIKit 0x348fe7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
9 UIKit 0x348fe215 -[UIApplication sendEvent:] + 44
10 UIKit 0x348fdc53 _UIApplicationHandleEvent + 5090
11 GraphicsServices 0x33a56e77 PurpleEventCallback + 666
12 CoreFoundation 0x3435da97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
13 CoreFoundation 0x3435f83f __CFRunLoopDoSource1 + 166
14 CoreFoundation 0x3436060d __CFRunLoopRun + 520
15 CoreFoundation 0x342f0ec3 CFRunLoopRunSpecific + 230
16 CoreFoundation 0x342f0dcb CFRunLoopRunInMode + 58
17 UIKit 0x34928d49 -[UIApplication _run] + 372
18 UIKit 0x34926807 UIApplicationMain + 670
19 Apli 0x00002bb3 main + 82
20 Apli 0x00002b5c start + 40
)
terminate called after throwing an instance of 'NSException'
(gdb)
Check that your MainWindow.XIB file is still in your project, and especially is checked to be included in your target.
I guess that your MainWindow.xib is not check to be included to your final Apli.app package, that explains why it is not found in your Bundle.
If you didn't "Clean" your previous builds of your app, a previous version of your compiled app bundle, including the MainWindow.xib file, may still be present in your simulator, explaining why the simulator still finds it. (If you "Clean all targets" from the "Build" menu, then rebuild your app on the simulator, I bet the simulator won't find your XIB file neither)

Could not load NIB in bundle [...] with name 'MainWindow' only on iPhone 4

I have a Problem with my App. It is working perfectly on my iPhone 3GS, but now where I tried to test it on an iPhone 4, it is crashing while the Splashscreen is visible.
Here's the log:
2011-07-06 16:01:05.611 Apptest [294:607] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/0C371068-7E74-4C54-997C-80E3B0929411/Apptest.app> (loaded)' with name 'MainWindow''
*** Call stack at first throw:
(
0 CoreFoundation 0x311ec64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3494dc5d objc_exception_throw + 24
2 CoreFoundation 0x311ec491 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x311ec4cb +[NSException raise:format:] + 34
4 UIKit 0x368c9a53 -[UINib instantiateWithOwner:options:] + 1110
5 UIKit 0x368cae09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
6 UIKit 0x366f54cd -[UIApplication _loadMainNibFile] + 96
7 UIKit 0x366efb09 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
8 UIKit 0x366c47d7 -[UIApplication handleEvent:withNewEvent:] + 1114
9 UIKit 0x366c4215 -[UIApplication sendEvent:] + 44
10 UIKit 0x366c3c53 _UIApplicationHandleEvent + 5090
11 GraphicsServices 0x36398e77 PurpleEventCallback + 666
12 CoreFoundation 0x311c3a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
13 CoreFoundation 0x311c583f __CFRunLoopDoSource1 + 166
14 CoreFoundation 0x311c660d __CFRunLoopRun + 520
15 CoreFoundation 0x31156ec3 CFRunLoopRunSpecific + 230
16 CoreFoundation 0x31156dcb CFRunLoopRunInMode + 58
17 UIKit 0x366eed49 -[UIApplication _run] + 372
18 UIKit 0x366ec807 UIApplicationMain + 670
19 Apptest 0x00002a0b main + 82
20 Apptest 0x000029b4 start + 40
)
terminate called after throwing an instance of 'NSException'
I hope you can help me. Thanks in advance.
Does the MainWindow.xib actually exist in your project?
You may have deleted it by accident. It may still work on the 3GS even if you deleted it from your project as it may well still be in the bundle on the 3GS.
I normally clean my projects and reset the simulator/uninstall the app from my device if I get inconsistencies like this.

Apples's Scrolling Example Crashes

I am trying to run the Apple's Scrolling Sample Code, but I get following Error:
Scrolling[45877:207] Unknown class ScrollingAppDelegate in Interface Builder file.
Scrolling[45877:207] Unknown class ScrollingViewController in Interface Builder file.
Scrolling[45877:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x4b33330> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewController.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00f0cbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010615c2 objc_exception_throw + 47
2 CoreFoundation 0x00f0cb21 -[NSException raise] + 17
3 Foundation 0x000306cf _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003063d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004af8d6 -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00e832cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004ae2ed -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004b0081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x002ba943 -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x002bb4ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
11 UIKit 0x002c5db2 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x002be202 -[UIApplication sendEvent:] + 71
13 UIKit 0x002c3732 _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x01842a36 PurpleEventCallback + 1550
15 CoreFoundation 0x00eee064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00e4e6f7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00e4b983 __CFRunLoopRun + 979
18 CoreFoundation 0x00e4b240 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00e4b161 CFRunLoopRunInMode + 97
20 UIKit 0x002bafa8 -[UIApplication _run] + 636
21 UIKit 0x002c742e UIApplicationMain + 1160
22 Scrolling 0x0000279c main + 102
23 Scrolling 0x0000272d start + 53
)
terminate called after throwing an instance of 'NSException'
The weird thing is, that I can't find those connections in the MainWindow.xib (The only xib file). The Outlets are properly connected to the AppDelegate and MyViewController classes.
The Runtime cannot find a way to create an instance of the classes "ScrollingAppDelegate" and "ScrollingViewController", which are serialized in the xib file. So it defaults to UICustomObject, which you don't have either.
Are you sure those classes exist in your source file(s) and that they are compiled correctly (i.e., part of the "Compile" build phase)?
Also check the spelling and the capitalization of the classes. It has to match between the xib files and the source files.
If something is wrong, there could be a yellow warning dot in the xib file (bottom-right). Click it for more info.
Finally, the sample code is marked as iOS4+. Do you have iOS 4 on your device?