I am tryingt o build an application where I am giving user liberty to add the emojis as in GTalk (e.g. :P :) :( ...). But I am not able to figure out the exact way to handle and display them once the characters are entered by the user.
Kindly pour in ideas for the same, as any form of help could trigger a solution for this.
For inputs you can use custom buttons, setting their titles with the unicode representation of the emojis. Iphone has native support for this.
[myButton setTitle:#"\ue415" forState:UIControlStateNormal];
For display it in a textbox you have to handle this as a single char of a string so you can concatenate your regular text with emojis.
A complete list of emojis are listed in this page: http://pukupi.com/post/1964/
Edit: You can use a conversion table
:) = \ue415
:( = \ue40e
....
You can use that conversion table with using images instead unicode chars but it is very complicated if you want to merge text and images in the same paragraph.
Here is an example using a property list if you want to use images
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SparkSetVersion</key>
<integer>1</integer>
<key>Emoticons</key>
<dict>
<key>angry.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>>:o</string>
<string>>:-o</string>
<string>>:O</string>
<string>>:-O</string>
<string></string>
</array>
<key>Name</key>
<string>Angry</string>
</dict>
<key>blush.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-[</string>
</array>
<key>Name</key>
<string>Blush</string>
</dict>
<key>confused.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>?:|</string>
</array>
<key>Name</key>
<string>Confused</string>
</dict>
<key>cool.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>B-)</string>
</array>
<key>Name</key>
<string>Cool</string>
</dict>
<key>cry.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:'(</string>
<string></string>
</array>
<key>Name</key>
<string>Cry</string>
</dict>
<key>devil.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>]:)</string>
</array>
<key>Name</key>
<string>Devil</string>
</dict>
<key>grin.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-D</string>
<string>:D</string>
<string></string>
</array>
<key>Name</key>
<string>Grin</string>
</dict>
<key>happy.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-)</string>
</array>
<key>Name</key>
<string>Happy</string>
</dict>
<key>laugh.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:^0</string>
</array>
<key>Name</key>
<string>Laugh</string>
</dict>
<key>love.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:x</string>
</array>
<key>Name</key>
<string>Love</string>
</dict>
<key>mischief.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>;\</string>
</array>
<key>Name</key>
<string>Mischief</string>
</dict>
<key>mischief.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>;\</string>
</array>
<key>Name</key>
<string>Mischief</string>
</dict>
<key>sad.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-(</string>
<string>:(</string>
<string></string>
</array>
<key>Name</key>
<string>Sad</string>
</dict>
<key>smile.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-)</string>
<string>:)</string>
<string></string>
</array>
<key>Name</key>
<string>Smile</string>
</dict>
<key>silly.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>:-p</string>
<string>:-P</string>
<string>:P</string>
<string>:p</string>
<string></string>
</array>
<key>Name</key>
<string>Tongue</string>
</dict>
<key>cool.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>8-)</string>
<string></string>
</array>
<key>Name</key>
<string>Cool</string>
</dict>
<key>wink.png</key>
<dict>
<key>Equivalents</key>
<array>
<string>;-)</string>
<string>;)</string>
<string></string>
</array>
<key>Name</key>
<string>Wink</string>
</dict>
</dict>
</dict>
</plist>
Related
I have been searching all the internet to correctly parse the following plist in swift but I cannot manage to find the correct way to do it. Please help. I have tried with multiple structures and classes with no result, the data will not fill the structures as it should.
If I try to cast it from bundle as NSDictionary it works but if I try to iterate through all of its dictionaries from class1, class2, etc appear as one single value that I cannot iterate through or work with.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>class1</key>
<dict>
<key>RANDOM_NAME1</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
<key>RANDOM_NAME2</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
</dict>
<key>class2</key>
<dict>
<key>RANDOM_NAME1</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
<key>RANDOM_NAME2</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
</dict>
<key>class3</key>
<dict>
<key>RANDOM_NAME1</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
<key>RANDOM_NAME2</key>
<dict>
<key>path</key>
<array>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
<string>test</string>
</array>
</dict>
</dict>
</dict>
</plist>
Please note that RANDOM_NAME1, RANDOM_NAME2 etc are random keys that i do not know, and their number may vary.
You can read information from plist file using this code:
Bundle.main.object(forInfoDictionaryKey: RANDOM_NAME1);
Otherwise you want to receive all plist file as dictionary to work with him you can use this code:
Bundle.main.infoDictionary
I'm trying to associate files type with my application (pdf and doc).
For pdf, it's Ok. I read this subject: How do I associate file types with an iPhone application?
and it works perfectly. But I tried to add the .doc type but it doesn't works.
EDIT: It works with this code (PDF, WORD and EXCEL):
Here is my app-info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon#2x.png</string>
</array>
<key>CFBundleTypeName</key>
<string>My Apps Files</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.composite-content</string>
<string>public.data</string>
<string>public.content</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.adobe.pdf</string>
<key>UTTypeDescription</key>
<string>PDF Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.composite-content</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pdf</string>
</array>
<key>public.mime-type</key>
<string>application/pdf</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.microsoft.word.doc</string>
<key>UTTypeDescription</key>
<string>Word Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>doc</string>
</array>
<key>public.mime-type</key>
<string>application/msword</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.microsoft.excel.xls</string>
<key>UTTypeDescription</key>
<string>Excel Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>xls</string>
</array>
<key>public.mime-type</key>
<string>application/vnd.ms-excel</string>
</dict>
</dict>
</array>
Hope it helps someone :)
Best regards,
Here Is code for Doc file formate but it may not work for images.
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Word</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.word.doc</string>
<string>com.microsoft.word.wordml</string>
<string>org.openxmlformats.wordprocessingml.document</string>
</array>
</dict>
I am trying to integrate the FacebookSDK-3.1.1 into my IPhone app (using Phonegap 2.1.0). I can't get back to my app once logged in.
My aim is facebook share using IPhone App.
Below i provide my [PROJECTNAME]-Info.plist file and Cordova.plist file.
Any help would be very much appreciated.
Thanks
[PROJECTNAME]-Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon.png</string>
<string>icon#2x.png</string>
<string>icon-72.png</string>
<string>icon-72#2x.png</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>com.Kwazzi.phonegap</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string></string>
<key>NSMainNibFile~ipad</key>
<string></string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>FacebookAppID</key>
<string>xxxxxxxxxxxxxxx</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxxxxxxxxxxxxxx</string>
</array>
</dict>
</array>
</dict>
</plist>
Cordova.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIWebViewBounce</key>
<true/>
<key>TopActivityIndicator</key>
<string>gray</string>
<key>EnableLocation</key>
<false/>
<key>EnableViewportScale</key>
<false/>
<key>AutoHideSplashScreen</key>
<true/>
<key>ShowSplashScreenSpinner</key>
<true/>
<key>MediaPlaybackRequiresUserAction</key>
<false/>
<key>AllowInlineMediaPlayback</key>
<false/>
<key>OpenAllWhitelistURLsInWebView</key>
<false/>
<key>BackupWebStorage</key>
<true/>
<key>ExternalHosts</key>
<array>
<string>*</string>
</array>
<key>Plugins</key>
<dict>
<key>org.apache.cordova.facebook.Connect</key>
<string>FacebookConnectPlugin</string>
<key>Device</key>
<string>CDVDevice</string>
<key>Logger</key>
<string>CDVLogger</string>
<key>Compass</key>
<string>CDVLocation</string>
<key>Accelerometer</key>
<string>CDVAccelerometer</string>
<key>Camera</key>
<string>CDVCamera</string>
<key>NetworkStatus</key>
<string>CDVConnection</string>
<key>Contacts</key>
<string>CDVContacts</string>
<key>Debug Console</key>
<string>CDVDebugConsole</string>
<key>Echo</key>
<string>CDVEcho</string>
<key>File</key>
<string>CDVFile</string>
<key>FileTransfer</key>
<string>CDVFileTransfer</string>
<key>Geolocation</key>
<string>CDVLocation</string>
<key>Notification</key>
<string>CDVNotification</string>
<key>Media</key>
<string>CDVSound</string>
<key>Capture</key>
<string>CDVCapture</string>
<key>SplashScreen</key>
<string>CDVSplashScreen</string>
<key>Battery</key>
<string>CDVBattery</string>
</dict>
</dict>
</plist>
You dont have the proper configuration in your [PROJECTNAME]-Info.plist. You miss "CFBundleURLName". Try the code below, it would help you.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.facebook.phonegap.myscheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxxxxxxxxxxxxxx</string>
</array>
</dict>
</array>
I have been doing some work for a while on an iPhone daily quote app, and the bulk of comments I received are to use a plist to store the quotes, and then setup the code to randomly access a quote each day. I have never really worked with a plist though, and am unsure as to the best way to build a new one filled with quotes. Could I get some guidance on this?
Your plist could look something like this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>A Quote</string>
<string>A Quote</string>
<string>A Quote</string>
</array>
</plist>
You can open a plist into an array like this. You'd then have an array of strings that you could do whatever you want with. Once you have an array I assume you know how to get a random object from it.
[NSArray arrayWithContentsOfFile:#"myPlist.plist"];
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
OkWU6AfEeAr3G1LVjwgv3QVl/C4=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash</key>
<data>
OkWU6AfEeAr3G1LVjwgv3QVl/C4=
</data>
<key>hash2</key>
<data>
bTnXxa3Ed3AQ3vCPs76DvwtUwOlgsWxMGNleo3ICfKA=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
I've setup other binary document types (such as zip archives) and they load from Safari and Mail just fine. But the XML based formats only run the "Quick View" and show the raw XML code. Is there something else that needs to be done to support XML based formats? Here is the info.plist I am using for these types:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon-72.png</string>
<string>Icon.png</string>
</array>
<key>CFBundleTypeName</key>
<string>GPS Exchange Format (GPX)</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.topografix.gpx</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon-72.png</string>
<string>Icon.png</string>
</array>
<key>CFBundleTypeName</key>
<string>Google Earth KML</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.google.earth.kml</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.google.earth.kml</string>
<key>UTTypeDescription</key>
<string>Google Earth KML</string>
<key>UTTypeReferenceURL</key>
<string>http://earth.google.com/kml/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>GKml</string>
<key>public.filename-extension</key>
<array>
<string>kml</string>
</array>
<key>public.mime-type</key>
<string>application/vnd.google-earth.kml+xml</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1/</string>
<key>UTTypeDescription</key>
<string>GPS Exchange Format (GPX)</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.google.earth.kml</string>
<key>UTTypeDescription</key>
<string>Google Earth KML</string>
<key>UTTypeReferenceURL</key>
<string>http://earth.google.com/kmz/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>GKml</string>
<key>public.filename-extension</key>
<array>
<string>kml</string>
</array>
<key>public.mime-type</key>
<string>application/vnd.google-earth.kml+xml</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeDescription</key>
<string>GPS Exchange Format (GPX)</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
</dict>
</array>
</dict>