Character count in MFMessageComposeViewController - iphone

Is there a way of showing the character count in the MFMessageComposeViewController? I have turned it ON in the iPhone settings for the native sms app but in my app it does not show it.

From MFMessageComposeViewController Class Reference :
Important: The message composition interface itself is not customizable and must not be modified by your application.
It's seem that you cannot change anything to this class.
Maybe there is a way to know if the option is enabled on the iPhone and, in this case, you'll put this key in NSUserDefaults but it will be surprising.

Related

change application icon and application name through localization in Xcode iPhone programmatically

I am working on Localization of my App to support English and Spanish language.I have created the string files for both english and spanish.All the strings in my app are managed by
`NSLocalizedString(#"key", nil);`
and give the expected result.I have given an option for changing the language inside my app in a tableview.
NSUserDefaults *nsdefault=[NSUserDefaults standardUserDefaults];
nsdefault setObject:[NSArray arrayWithObject:#"en"] forKey:#"AppleLanguages"];
nsdefault synchronize];
1) I need to change the app name and icon depending on the selection of language in tableview.For app name i used "CFBundleDisplayName" = "Librairie";
so that the next time i launch the app the app name and icon should change.
2)for app name
`"CFBundleDisplayName" = "Librairie";`
.It works only if i go to iPhone's setting and change the language manually.Through code it doesn't work.
Please suggest me the approach i can follow so that when i choose spanish language from my tableview the name and icon gets replaced.
can i localize the app icon image also like we do for any image used in UIView ?
Any help would be appreciated
Thanks
You can't change neither the app icon, neither the display name. Both of those are read only once the app is installed, and even if you could, those would create a really bad user experience.

How to check if any apps are associated with file extension

I want to make "Open in.." function in my iOS application.
Is there any way to check if any app on this device is associated with file extension that i want to share?
If there are no apps on current device to open file with such an extension than UIDocumentInteractionController will not be displayed after clicking on "Open in.." button, but i want not to show this button in such case.
So the question is: how to check if any app on device can open some file with specific extension?
Update:
For example UIDocumentInteractionController has NSArray property icons.
It contains images of all aplications that can open the file with my extension. But if there are no applications it contans image of empty application.
So i can't check it using docInteractionController.icons.count == 0 for example. I am looking for other tricks.'
Thanks, in advance.
Although UIDocumentInteractionController does not offer a way to discover in advance whether there are any applications that can handle a document, -presentOpenInMenuFromRect: will return a flag indicating whether there were any applications that could open a document. This requires you to have already set up and presented the controller, which is not optimal.
There is a workaround for this, a little hacky but is functional: Before you invoke the "real" interaction controller, create a dummy one using a dummy document, and present it from the rect of the window's bounds. This guarantees that it will "appear" offscreen, so your user won't see it. At that point, you have the flag returned from -present, and you can immediately dismiss the dummy controller, and the proceed to show your UI appropriately.
On OSX, you can get a list of application bundle identifiers capable of handling a specific content type using LSCopyAllRoleHandlersForContentType. But on iOS, I don't think there is such a way.
If I find, I'll edit my answer.
Considering you are looking for other tricks, you can check if that one image in the icons array is the generic document icon.
If it is then you know that there is no app associated to handle that file type. But this approach will be OS version dependent as generic file icon may change.
From the official documentation:
To declare its support for file types, your app must include the
CFBundleDocumentTypes key in its Info.plistproperty list file. (See
“Core Foundation Keys”.) The system adds this information to a
registry that other apps can access through a document interaction
controller.
To me this indicates that the registry can only be accessed through UIDocumentInteractionController and so no, you would not be able to know in advance if there are any available apps for the file format (which would be totally in line with Apple's philosophy of not letting apps interact directly with each other).
UPDATE:
as you said the icons property contains an image even with no applications present. I checked and all the other methods and properties of the controller do not give an hint about the apps that may open the current file format.
You said in case that no app can open the specified file format there is an "image of empty application". Maybe you can extract that icon and when the array icons only has one image check if the extracted image and the icon are the same?

Cannot type using non-QWERTY keyboards on iOS

My iPhone app can't seem to use soft keyboards that doesn't use the US-like QWERTY layout. That is when I set the keyboard to French or Germany, even text fields cannot take in text and an error message No input manager class for input mode error is shown in the console (when debugged under Xcode). Switching to the Emoji keyboard also shows the same problem. But the problem doesn't occur on QWERTY keyboard layouts, like Dutch and Indonesian keyboards.
The all cases are consistent and reproducible both the device (iPhone 4) and the iPhone simulator.
These are error messages in the Xcode's debugger console
When the keyboard is set to French:
No input manager class for input mode: fr_FR
When the keyboard is set to Germany:
No input manager class for input mode: de_DE
When the keyboard is set to Emoji:
No input manager class for input mode: emoji
My app's deployment target is iOS 3.1.3 (I'm still supporting 1st gen devices) but the development environment is Xcode 4.3.1 and iOS 5.1 Simulator. (I don't know whether this is relevant but just in case).
Anybody can help how to fix this?
Thanks in advance.
In my case, this was caused by my swizzling -[NSBundle infoDictionary] and returning a copy of the original dictionary.
I did this to be able to change info dictionary values at runtime (specifically, providing a non-shortened bundle display name to replace the shortened value used on the home screen).
The fix was to not return a copy of the info dictionary, but with some more reflection magic handle each key obtained from the dictionary:
https://github.com/Lyndir/Pearl/blob/master/Pearl/NSBundle%2BPearlMutableInfo.m
Not sure if this answer will help you but I found it from this link: http://code.google.com/p/networkpx/wiki/Creating_Keyboard_Bundles
Anyway here is what I am talking about:
Like UIKeyboardLayoutClass, this field also can be referred using the
same "=xxx" syntax. You can also write the class name of your own
input manager class here.
If this field is missing, no input managers will be used.
Hopefully this will help you!

Turning off Spell checker in a iPhone App

Developing a iPhone application - where I want the 'Spell checker' functionality to be turned off when the application starts, firstly, is this possible? if yes, can someone help me with the code for the same?
Secondly, if this is possible, and what would happen, if the user pauses my application, and goes and starts another application, for instance sending a SMS where by default the iOS turns on the spell checker - when the user would switch back to my app, would the spell checker be turned on then?
Whether or not it’s enabled is a property of the text field, not of your application. It’s specified in the UITextInputTraits protocol; to disable autocorrection on a text field, you’d do this:
[myTextField setAutocorrectionType:UITextAutocorrectionTypeNo];
You can do this by checking out the attributes when you select the UITextField or UITextView options

Customize iPhone Dialer

Is there a way to customize the calling dialer interface of iphone to make calls and everything as that the iphone dialer supports by using a public API reference. If there is a way then can anyone please direct me to a proper link where I can read about it. I know
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://8005551212"]];
this helps to make a call but I want to not open the default interface which I don't want to open. I will appreciate if anyone can help me with this.
Regards,
Ankur
No, there's no public interface for that. If you really need that feature you can try to send bug report to Apple with a request for it.
As #Vladimir says, this is not built in, so you'll need to build your own.
To do so is pretty easy:
Create a xib file with a set of UIButtons (for #s 1-9), a UILabel to show the currently entered number, and a "Call" button.
Hook up the presses on the number UIButtons and add the digit to a local variable NSString on your ViewController. Update the UILabel with this number.
When the call UIButton is pressed, take the locally stored # and place the aforementioned method call with it.
Originally from my answer here.