When you use the operator, you are comparing pointer values. This will only work when the objects you are comparing are exactly the same object, at the same memory address. You can also use isEqualToData: method.
This method return YES if the contents of Data are equal to the contents of the receiver, otherwise NO. Two data objects are equal if they hold the same number of bytes, and if the bytes at the same position in the objects are the same.
Up vote 0 down vote favorite share g+ share fb share tw.
I am assigning image to nsdata object from my Coredata and after assigning it m checking that whether the NSData has image or not. If the data is not null I have t show it else I m Checking it in NSLog that No Image is Found. NOTE : App is crashing only when there is no image in the object.
I tried NSData * dataImage; if (dataImage == nil) { NSLog(@"Image is Assigned .... " ); }else { NSLog(@"Image is Not Assigned ITS NIL.... " ); } and my device consle looks like this : Wed Nov 16 12:31:09 unknown ReportCrash783 : Formulating crash report for process Dial Up App782 Wed Nov 16 12:31:09 unknown com.apple. Launchd1 : (UIKitApplication:com.hiteshi. Dial-Up-App0x1b63) Job appears to have crashed: Segmentation fault Wed Nov 16 12:31:09 unknown SpringBoard24 : Application 'Dial Up App' exited abnormally with signal 11: Segmentation fault Wed Nov 16 12:31:10 unknown ReportCrash783 : Saved crashreport to /var/mobile/Library/Logs/CrashReporter/Dial Up App_2011-11-16-123107_Priya-Chaturvedis-iPhone.
Plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0 I don't know wher I am getting wrong, Application is running smoothly on simulator but crashes on device..... Please Help... iphone objective-c sdk uiimage nsdata link|improve this question edited 11-11-168 at 7:07 asked 11-11-168 at 6:48Iphony917 84% accept rate.
– NSResponder Nov 16 '11 at 6:50 pplication 'Dial Up App' exited abnormally with signal 11: Segmentation fault. App crashing on Device and not on simulator... – Iphony Nov 16 '11 at 6:54 From where you get the image – Harish Nov 16 '11 at 8:53 Tell us who's providing the image, my thought is that the image is being released and a nil reference is somehow being used. – Mr.Gando Nov 16 '11 at 8:56 I was fetching image from my database table.
Thanks for your interest! – Iphony Nov 16 '11 at 10:12.
When you use the == operator, you are comparing pointer values. This will only work when the objects you are comparing are exactly the same object, at the same memory address. You can also use isEqualToData: method.
This method return YES if the contents of Data are equal to the contents of the receiver, otherwise NO. Two data objects are equal if they hold the same number of bytes, and if the bytes at the same position in the objects are the same. NSData * dataImage = NSData allocinit; if (dataImage == nil) { NSLog(@"Image is Assigned .... " ); }else { NSLog(@"Image is Not Assigned ITS NIL.... " ); } // Output:Image is Not Assigned ITS NIL....
Thanks For your suggestion, I'll remember this while every comaprarison in objective C. :) – Iphony Nov 16 '11 at 10:11.
You have it backwards, you need: if (dataImage! = nil).
No Effect of reversing the condition. App is crashing on same point on condition. – Iphony Nov 16 '11 at 7:06.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.