including Kal.a (from Kal calendar) and including libidn.a (xmpp framework) causes app to crash - iphone

After trying really hard i am posting this qustion in the 2 o clock of night in my office.
The problem is :
1) i have included Kal calender (link here) in my application
2) And its really working fine before i decided to include xmpp framework(xmpp framework) in my application.
3) The Main problem is when i try to include libidn.a file and then compile the project it gives me 4 errors , and to remove these error i have to remove "Other linker flag -> -all_load".
4) Here the problem begins when i have removed -all_laod flag and compile , app compiles success fully. But i try to run my app and press calendar button to load calender it crashes with following error:
-[__NSDate cc_dateByMovingToFirstDayOfTheMonth]: unrecognized selector sent to instance 0x75b85c0 2012-06-12 01:38:47.483 BizPro[10251:11903]
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate
cc_dateByMovingToFirstDayOfTheMonth]: unrecognized selector sent to
instance 0x75b85c0'
* First throw call stack: (0x209e022 0x22f0cd6 0x209fcbd 0x2004ed0 0x2004cb2 0x12bc3d 0x12bb91 0x13149e 0x1315f6 0x12961 0xa8d38f
0xa8d5eb 0xa9dff1 0xa9e85f 0xa9e9e1 0xbbc5c2 0xa02d21 0x209fe42
0x856679 0x860579 0x7e54f7 0x7e73f6 0x874160 0x9d4f30 0x207299e
0x2009640 0x1fd54c6 0x1fd4d84 0x1fd4c9b 0x26e67d8 0x26e688a 0x9c4626
0x2a9d 0x2a15 0x1) terminate called throwing an exception(lldb)
4) I know very well that this error is a misguide (NSDate is not causing the crash but the collision of static libraries is doing it , i think so) , because when i again add -all_load flag and remove the libidn.a file from my project , It compile and RUN successfully and calendar displays my data smoothly.
i googled a lot about it .. and got very little guidance .. relating the solution to workspaces and all that .. But i really dont know what could be the solution .. Plz help me
Thanks

cc_dateByMovingToFirstDayOfTheMonth
is an addition to NSDate that is defined in NSDateAdditions.h from the Kal Framework.
I had no end of problems and wanted more customisation of the Kal framework so I just dragged all the source code into my project.
If you still have issues with the framework then remove Kal.a and just bring in the source code :) then you can get dirty with it

If you rather keep Kal as a subproject, the way to fix this is to link the addition files.
Under
Project -> Build Settings -> Linking -> Other Linker Flags
add '-all_load'

sorry i am answering late ..
i solved the problem ..
removed kal.a file and just included src folder (all the header files required)
so that i will not collide with the other static library ...

Similar problem here. Because I'm using Parse Framework, can't add -all_load, so integrating static library will never work for me. The simplest way is to add all source files in src folder to my own project, rather than adding Kal.xcodeproj. Other steps to config "copy bundle files" or "header search path" etc are still necessary. I also need to add these lines from Kal_Prefix.pch to my own project.pch.
#import "NSDate+Convenience.h"
#define RGBCOLOR(R,G,B) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1]
#define RGBACOLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
#define kDarkGrayColor RGBCOLOR(51, 51, 51)
#define kGrayColor RGBCOLOR(153, 153, 153)
#define kLightGrayColor RGBCOLOR(185, 185, 185)

Related

NSInternalInconsistencyException with 'CGPDFDocumentRef == NULL'

I am building a Newsstand universal app. When I download a magazine issue and open it, it runs fine, but when I delete it, redownload, and open it it throws the following:
2013-04-01 22:06:07.672 Magazine[14353:707] *** Assertion failure in -[ReaderContentPage initWithURL:page:password:], /Volumes/Files/Work in progress/el-beit/Magazine/Sources/ReaderContentPage.m:471
2013-04-01 22:06:07.680 Magazine[14353:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CGPDFDocumentRef == NULL'
*** First throw call stack:
(0x35a4788f 0x3366b259 0x35a47789 0x34e3b3a3 0x84e59 0x85ba7 0x96d47 0x976ad 0x34e6d933 0x35a1ba33 0x35a1b699 0x35a1a26f 0x3599d4a5 0x3599d36d 0x33738439 0x33175cd5 0x6cf81 0x6cf08)
terminate called throwing an exception(lldb)
I delete the file by deleting its issue:
NKLibrary *nkLib = [NKLibrary sharedLibrary];
NKIssue *issue = [nkLib issueWithName:[kBaseFeatureID stringByAppendingString:((NSNumber *)self.listOfMonths[index]).stringValue]];
NSString *name = issue.name;
[nkLib removeIssue:issue];
[nkLib addIssueWithName:name date:[self.dateFormatter dateFromString:((NSNumber *)self.listOfMonths[index]).stringValue]];
I am using Newsstand, iOS6, Xcode 4.6, MKStoreKit, and the template of this project: https://github.com/vfr/Reader
The reader seems to be trying to open the deleted file instead of the file I give to it.
Any help would be appreciated, thanks in advance.
I solved this issue by using
[[ReaderDocument alloc] initWithFilePath:file password:nil];
instead of
[ReaderDocument withDocumentFilePath:file password:nil];
I think that this post could solve your problem.
I get the same error, but from a different Workflow. If I download a file and save it to the filesystem the error appears, but if I add the same file to my AppBundle it gets displayed without any problem.
I hope that this helps, eventually you have any advice whats wrong at my case. I suggest that this is because of the same reason.
The plist file was the problem, it didn't get deleted automatically when you deleted your PDF. You have to either make sure all your PDF file names are unique, or remember to delete the plist file which is automatically generated by the Reader based on PDF file name.
E.g. /appid/Library/Application Support/yourPdfFileName.plist
Do it every time when you delete your PDF. It should solve your problem.

How to use RegexKitLite in Xcode 4.3.1?

I'm having trouble to use RegexKitLite to match string like
NSString *encodedPoints=[apiResponse stringByMatching: #"\\\"([^\\\"]*)\\\"^[^:]*"
capture: 0];
and apiResponse is:
#"http://maps.google.com/maps?output=dragdir&saddr=20.001364,73.749283&daddr=19.991499,73.744095"
So, to do by this way i am getting following error:
__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x131fc0
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString
stringByMatching:capture:]: unrecognized selector sent to instance
0x131fc0'
* First throw call stack: (0x3422b8bf 0x3447b1e5 0x3422eacb 0x3422d945 0x34188680 0xb97b 0xad2f 0xaa2d 0xa617 0x34185435
0x375ef9eb 0x376b53cf 0x34185435 0x375ef9eb 0x375ef9a7 0x375ef985
0x375ef6f5 0x375f002d 0x375ee50f 0x375edf01 0x375d44ed 0x375d3d2d
0x30a06df3 0x341ff553 0x341ff4f5 0x341fe343 0x341814dd 0x341813a5
0x30a05fcd 0x37602743 0x4571 0x2838)
I have trying to find solution with googling but not getting exact solution.
Please help...
Ensure you have the correct library included into your project.
Go to your Project Navigator and selet the project.
Click on the Target and select the Build Phases tab, and open the Link Binary With Libraries.
Press the + Button, and search for libicucore.A.dylib. Add this library to your project.
Next, you will need to add the compile source, which is in Compile Sources just above Link Binary With Libraries. Once again, hit the + button and add RegexKitLite.m to the target. If you attempt to build the project at this state, you should get a lot of errors in the RegexKitLite.m file. To correct this, add the following compiler flag to the file by double clicking the RegexKitLite.m file in the Compile Sources area and then including -fno-objc-arc into the pop-up that appears. Hit done, and you will have hopefully added the library source to your project.
Just as a note, -fno-objc-arc removes the Automatic Reference Counting while compiling that source file. The errors the file gets without that compiler flag have to do with ARC, so it solves the problem.
This solved my issues when working with RegexKitLite, so hopefully it will for you.

iphone: co-processor offset out of range

i have a strange compiling problem with xcode and iphone. my game is almost finish but now i got suddently this compiling error:
{standard input}:6108:co-processor offset out of range
gcc-4.2 failed with exit code 1
this only happens if i compile the release version for the device. the debug version and both versions for the simulator works. clean targets and recompile don't work.
strangly enough that error only happens if i add a line of code to one specific source file and only between these lines:
[_sharedDirector checkAndPutScoreToHighscore:(int)[player score]];
gameOverScreen = YES;
gameOverScreenSlideY = 320.0f;
[buttonManager activateButtonWithID:replayButton];
[buttonManager activateButtonWithID:menuButton];
so when i put a random line between this lines of code i get that error.
i do not know what causes this error. i had opened the sourcecode file to "show as assembly file" just for fun but i don't think this has caused the error.
has anybode a hint for me what could be going on? i am searching the web for over 3 hours and thats very frustrating.
You most likely found a compiler bug. You really should switch to the LLVM compiler (clang).

Exception when running on simulator 3.2

I'm testing my app on simulator 3.1.3, it runs fine.
When it come to simulator 3.2, it crashes right from the beginning:
2010-06-24 16:35:29.208 MyTestApp[6991:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
2010-06-24 16:35:29.213 MyTestApp[6991:207] Stack: (
46195275,
2520474889,
46194715,
46194554,
6387912,
6392266,
5568184,
6388086,
6386450,
6392266,
5564974,
5573454,
3555255,
3560368,
3586056,
3567777,
3599431,
52998524,
45735996,
45731912,
3559044,
3591649,
10824,
10678
)
As far as I know, I do not use the "initWithCoder" method (do not really know what this is though).
How can I know where the exception is thrown so I could have a better understanding of what is causing the problem?
ps: I have added an exception in Breakpoint: objc_exception_throw (with location libobjc.A.dylib, strangely I had to enter the location manually, I expected xcode to find it for me when I added objc_exception_throw). But still the same trace and no more information.
This page should provide some helpful info: Debugging Tips for Objective-C
Of particular interest is the console command info line *. Every one of those numbers listed by the exception log is an address on the stack. Those bottom ones in the 10,000 and below range are usually located in the app's main method, for example. The highest ranged addresses tend to represent the default libraries.
Using the command info line *10678 would likely return some info about a specific line in the main method, which doesn't help very much. Normally the trick is to find the highest address before the default libraries begin. I'm unsure how much this will help your problem in particular, seeing as there's a huge gap between the expected small addresses and the next highest up. In any case, start with the smallest address above the bottom two (3555255 from what I can see in the log you posted) and see if it returns a line from one of your own code files. If it does, check the one above it, and so on until you find the last address from your own code. Hope this helps.
I figured out the reason of this error. I had created an object of type NSDictionnary within IB and it seems it was not the correct way to do this. Instead I have programmatically created this same object in XCode and this works fine. Seems like it was some kind of persistent problem.

Compile error in CorePlot-CocaTouch project

I'm having trouble compiling the current release.
I was able to download a copy of the source distribution today using:
hg clone https://core-plot.googlecode.com/hg/ core-plot
I opened the "core-plot/framework".
I then double clicked on CorePlot-CocoaTouch.xcodeproj to launch Xcode.
When I build the project I get the following error:
-(void)bind:(NSString *)binding toObject:(id)observable withKeyPath:(NSString *)keyPath options:(NSDictionary *)options
{
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
[NSException raise:CPException format:BindingsNotSupportedString];
Format not a string literal and no formal arguments
#else
[super bind:binding toObject:observable withKeyPath:keyPath options:options];
#endif
}
I am running on a new MacBook with OS 10.6, and IPhone Simulator 4.0.
Any help will be greatly appreciated.
Charles
A more appropriate place to ask this question would be the Core Plot mailing list, because I'm one of the few developers for the project that regularly visits here.
That said, the issue here is that we're using a string constant for a format string, which Xcode now seems to be warning about (rightly so, as this can lead to problems). To work around this for now, you can replace the line in CPLayer.m
static NSString * const BindingsNotSupportedString = #"Bindings are not supported on the iPhone in Core Plot";
with
#define BindingsNotSupportedString #"Bindings are not supported on the iPhone in Core Plot"
Search in your project for BindingsNotSupportedString, seems like it's not in the current file and therefore needs to be included. Or just try to change this to an acceptable format.