iphone-sdk-3.0

How to convert a NSString to UTF-8 format string in iphone sdk?

大兔子大兔子 提交于 2019-11-29 18:51:40
问题 I have localization in my app(english,spanish,italian).The client sent me strings files but some characters are strange how do i correct them? i have figured out that the client used Mac OS Roman encoding how do i convert this to utf-8. for example Nürnberg is converted into N√ºrnberg when client send me now i want to reconvert it. 回答1: If you have a properties file with all of the strings... you can load them in and read them with any of these (from NSString's Documentation): – initWithBytes

Great UIKit/Objective-C code snippets

寵の児 提交于 2019-11-29 18:35:59
New to Objective-C iPhone/iPod touch/iPad development, but I'm starting to discover lots of power in one-liners of code such as this: [UIApplication sharedApplication].applicationIconBadgeNumber = 10; Which will display that distinctive red notification badge on your app iphone with the number 10. Please share you favorite one or two-liners in Objective-C for the iPhone/iPod touch/iPad here. PUBLIC APIs ONLY . RRUZ Open an URL in Safari [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com/"]]; Hide the status bar [[UIApplication sharedApplication]

NSArray - check if objects are in an array?

这一生的挚爱 提交于 2019-11-29 16:07:31
I have 2 arrays. One is a large static group of 600 objects, the other is a small varying group of 10 objects. I want to take any common objects between the two groups and put them in a new array. So lets say the large group contains 600 objects named 1 to 600. The smaller group contains 9 objects: 1, 2, 3, 4, 5, 6, a, b, c. I want to be able to create a new array that contains the objects 1, 2, 3, 4, 5, 6. What is the best way to do this? Are you sure that you need NSArray s? For intersections it would be better to use NSSet s. For more information about the usage of NSArrays and NSSet please

Calling javascript from objective-c code

╄→尐↘猪︶ㄣ 提交于 2019-11-29 15:43:43
问题 I found a lots of ways to call objective-c code from javascript, but I want to call the javascript code from objective-c. Last time I submitted a HTML FORM from objective-c, and now I wan't to call a javascript method. What do you think, is there any way to call it and get the response? I am interested in any solution, but I started to think and I think I need to send a html call or something like this, but I am not sure about this because the javascript is client side code, so maybe I need

UISearchBar Search table row with text, subtext and image

别来无恙 提交于 2019-11-29 15:41:43
I've noticed that in order to do a search of a table, a copy of that data must be inserted to a search array. E.g. //Initialize the array. listOfItems = [[NSMutableArray alloc] init]; NSArray *countriesToLiveInArray = [NSArray arrayWithObjects:@"Iceland", @"Greenland", @"Switzerland", @"Norway", @"New Zealand", @"Greece", @"Rome", @"Ireland", nil]; NSDictionary *countriesToLiveInDict = [NSDictionary dictionaryWithObject:countriesToLiveInArray forKey:@"Countries"]; NSArray *countriesLivedInArray = [NSArray arrayWithObjects:@"India", @"U.S.A", nil]; NSDictionary *countriesLivedInDict =

strange GDB error unable to trace

帅比萌擦擦* 提交于 2019-11-29 15:23:01
I am getting this strange error in gdb and i'm unable to trace the exact line of code to trace the bug. Does someone knows about this type of bug? Here is what i get in gdb *** -[CALayer sublayers]: message sent to deallocated instance 0x911c2a0 (gdb) po 0x911c2a0 Program received signal SIGTRAP, Trace/breakpoint trap. 0x020993a7 in ___forwarding___ () The program being debugged was signaled while in a function called from GDB. GDB has restored the context to what it was before the call. To change this behavior use "set unwindonsignal off" Evaluation of the expression containing the function (

Uplooad Video facebook-ios-sdk : uploaded but not shown on my FB Wall and in My Video

爱⌒轻易说出口 提交于 2019-11-29 11:56:56
I have upload the video on facebook using following code Help From : https://github.com/zoul/facebook-ios-sdk/ Full Discussion on Stackoverflow : Facebook iOS Upload Video "Unable to retrieve session key from the access token." Code FBVideoUpload *upload = [[FBVideoUpload alloc] init]; upload.accessToken = facebookObj.accessToken; upload.apiKey = fbAppKey; upload.appSecret = fbAppSecret; NSString *filePath = @"/Users/pratgupta/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE/IMG_0010.M4V"; NSURL *fileURL = [NSURL fileURLWithPath:filePath]; NSMutableDictionary *params =

Error Using PHP for iPhone APNS

让人想犯罪 __ 提交于 2019-11-29 11:39:42
I have been getting this error messages from my PHP code used to send message to the APNS...has anyone got faced the same issue? Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL routines: SSL3_READ_BYTES:sslv3 alert handshake failure in /Library/WebServer/Documents/anish/apns/2.php on line 8 Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /Library/WebServer/Documents/anish/apns/2.php on line 8 Warning: stream_socket_client() [function.stream-socket-client]:

Core data setReturnsDistinctResult not working

自古美人都是妖i 提交于 2019-11-29 11:25:26
So i'm building a small application, it uses core data database of ~25mb size with 4 entities. It's for bus timetables. In one table named "Stop" there are ~1300 entries of bus stops with atributes "name", "id", "longitude", "latitude" and couple relationships. Now there are many stops with identical name attribute but different coordinates and id. So I want to show all distinct stop names in table view, i'm using setReturnsDistinctResults with NSDictionaryResultType and setPropertiesToFetch. But setReturnsDistinctResult is not working and I'm still getting all entries. Heres code: -

Getting started in Core Data for iPhone?

一笑奈何 提交于 2019-11-29 11:10:41
I want to implement Core Data into my iPhone app. So what is the best way to learn Core Data specifically for the iPhone? I have 4ish hours that i can devote to this today, so ideally I would be competent enough to add this (however slightly) into my app. The only way i retain data now is through NSUserDefaults, just so that when the app is closed and reopened, their data is still there. I want to give the user the ability to save sets of data, read them, edit them, delete them, etc. Getting Started with Core Data in the iPhone Dev Center did the trick for me. :-) No, seriously, it might seem