adding custom fonts to application - objective-c

In my project, I'm using a custom font named "COMICS.TTF"... For that I added the font file named "COMICS.TTF" into resources and edited the plist to include a new field specifying
"Fonts provided by the application COMICS.TTF "
After that, I accessed the font usig UIFont's fontWithName:#"Comics" size:40.0 method...
(Comics is the font name that I got when I tried to NSLog font names)... All these worked perfectly in iPhone 4... But, when I tried to install the program in iOS3.1, it is throwing an exception as follows...
*** Assertion failure in -[UILabel setFont:], /SourceCache/UIKit/UIKit-984.38/UILabel.m:445
2011-03-07 14:24:20.271 CMB[183:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: font != nil'
2011-03-07 14:24:20.291 CMB[183:207] Stack: (
853417245,
845594132,
852966195
Also, it's not showing the font name when tried to NSLog the font name... Does anybody know, what's the problem?

adding your custom fonts became available in 3.2 and later versions so, if you are trying to use it on 3.1 it won't work

Related

Crash in the execution of a queue glmtl.telemetry

Exactly 60 seconds after launching my app it crashes with an uncaught exception:
libc++abi.dynlib: terminating app due to uncaught exception of type NSException
*** Terminating app due to uncaught exception of type 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: BundleVersion)'
The crashing thread has a random number (it is #7 in the attached screenshot) and it is always created for an unknown to me queue glmtl.telemetry.
The crash occurs only on one device (iPhone 11 Pro Max) and iOS 14.0 (it was then replicated with iOS 14.0.1).
I am not using in the project anywhere a key "BundleVersion". (There is CFBundleVersion in the info.plist, but does not seem to be related).
Can this be caused by the project sources?
This is not an explanation of the issue but the crash stopped appearing after adding a group of missing resource files to a folder (not a group but a folder) in the bundle.
Fix
I am having the same issue. In my case, I needed to add CFBundleVersion to the project's Info.plist since the exception mentions the "BundleVersion" key and because I recalled seeing XCode complain about invalid bundles when that key is missing.
My guess is that those recommended CFBundle* keys should be set for the main project's Info.plist and any embedded framework or projects with their own Info.plist. I'm just surprised XCode 12 doesn't raise that error right now at build time.
Source of the issue (?)
Do you use OpenGL in your app? I could not find what glmtl is, but it seems that the crash occurs exactly 1 minute after I instantiate a new OpenGL context. The crash will still occur after 1 minute if I delete the context before that, but it will be delayed another minute if I create a new instance in between.

NSHealthShareUsageDescription must be set in the app's Info.plist in order to request read authorization

I have a framework that uses
_healthStore requestAuthorizationToShareTypes:writeTypes readTypes:readTypes completion:^(BOOL success, NSError *error) {
When I include the framework into my iOS app and put the following in my app info.plist file
<key>NSHealthShareUsageDescription</key>
<string>Read heart rate monitor data.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Share workout data with other apps.</string>
everything works fine - not including those keys results in the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthShareUsageDescription must be set in the app's Info.plist in order to request read authorization.'
My problem is that when running the unit tests for the framework it crashes with the above error. I've put the keys in all of the info.plist files for the framework and for the test target but still get the crash.
Which plist file should the keys go into in order to run the test target?
(should also mention that I'm in the process of switching over to Swift3 - this is part of the project that is in Objective-C - prior to iOS10 and XCode 8 this all worked fine).
I've created a framework with appropriate unit test to show the problem: https://github.com/asensei/HKHealthStoreFrameworkUnitTestBug
You must add the NSHealthShareUsageDescription and NSHealthUpdateUsageDescription keys to the Info.plist file in your application. You do this by:
Clicking on the "Info.plist" file
Right clicking the screen and select add rows.
scroll to "Privacy - Health Share.. " and "Privacy - Health Update.. "
Select both of those and you should be good.
You have to add two descriptions NSHealthUpdateUsageDescription and NSHealthShareUsageDescription, and then give each of them a description. See screenshot below.

New Google maps on iOS 6 implementation crash

I successfully implement new SDK from Google to my test project on iOS 6. When I add code from there tutorial I get such exception:
GoogleMapsBack[7306:5103] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'GMSCachedTile''
*** First throw call stack:
(0x27b0012 0x25d5e7e 0x10373e7 0x34bea 0x30c52 0x2a4f53f 0x2a61014 0x2a51418 0x2a512a6 0x2a52280 0x2a52450 0x97401e12 0x973e9cca)
libc++abi.dylib: terminate called throwing an exception
Does anyone know what is it the problem ?
https://developers.google.com/maps/documentation/ios/start
you forgot step 4:
"Drag the GoogleMaps.bundle from the Resources folder to your project. We suggest putting it in the Frameworks group. When prompted, ensure Copy items into destination group’s folder is not selected."
i encountered the same problem, and this fixed it.
regards,
Tomer

How to use Xcode output to determine source of crash?

I have the following output from my app at the moment:
2012-09-14 11:55:32.558 projectname[2172:707] -[__NSCFBoolean isEqualToString:]:
unrecognized selector sent to instance 0x3ec4ba18
2012-09-14 11:55:32.570 projectname[2172:707] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean isEqualToString:]:
unrecognized selector sent to instance 0x3ec4ba18'
*** First throw call stack:
(0x3263788f 0x3468d259 0x3263aa9b 0x32639915 0x32594650 0x41e47 0x417d3 0x46af7
0x320beefb 0x320bdfd9 0x320bd763 0x32061f15 0x325961fb 0x342faaa5 0x342fa6bd
0x342fe843 0x342fe57f 0x342f64b9 0x3260bb1b 0x32609d57 0x3260a0b1 0x3258d4a5
0x3258d36d 0x316e4439 0x3208ccd5 0x17e77 0x15ca4)
terminate called throwing an exception
I can see that the problem is that I'm trying to compare a BOOL to an NSString, the comparison is on data from a web service and it's always been BOOL before now. That's besides the point in this case anyway.
What information is in that log that can actually help me find the line of code that's causing the problem? I can see which instances (e.g. 0x3ec4ba18) are causing it but the log doesn't even tell me what type they are, let alone a line number.
Add an exception breakpoint by going to the exceptions pane (in the left sidebar), clicking the + and selection "Exception breakpoint". Then when you run the debugger will pause where the exception is actually thrown rather then when it is caught (or rather uncaught) at the top level.
There are many tutorials on this, Raywinderlich has one of good tutorial for determining crash from the console log..
Here you can get them..
My App Crashed, Now What? – Part 1
My App Crashed, Now What? – Part 2
After following these, come to know the specific reason of crash then google for this, you can resolve it easily.

add categories in xcode4

I copied the timeAgo category for NSDate in XCODE4, but i get the following runtime error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate timeAgo]: unrecognized selector sent to instance 0x17e000'
I read in other posts i need to add a linking flag, which I did as follows:
But its still not working. What am I missing to use third party categories?
I don't think you ought to mess with the linkers, at least not there. Wherever you got that category from may have mentioned that the file you put that in needs to be compiled, which you check by going to your project settings -> Build Phases -> Compile Sources. Make sure the category's .m file is in there.