nsstring

AFNetworking 3.0 The data couldn’t be read because it isn’t in the correct format

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There are other questions with similar titles but none of them helped me. I've to send a PUT request to server in order to change the status of appointment so I've made this method -(void)appointmentStatusChangedTo:(NSString *)statusID atAppointmentID:(NSString *)appointmentID In which I'm setting the URL and Parameters as NSString *string = [NSString stringWithFormat:@"%@/API/Appointments/3",BaseURLString]; NSDictionary *para = @{ @"AppointmentStatusId":statusID, @"ID":appointmentID }; Then I've made URL request as AFURLSessionManager

query sqlite error out of memory xcode

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an error. Problem with prepare statement: out of memory. How to fix it? Other queries are working normally. I do not know what can be. Maybe this is a problem -(TelefonDetail *)telefonDetails:(int)iDMob ?? -(TelefonDetail *)telefonDetails:(int)iDMob { TelefonDetail *retvalTelefon = nil; NSString *ZaprosTelefons = @"SELECT iDMob , marka, model,wifi, os, razmeri,Display,Camera,Stoimos,imageTel,opisCrat FROM MobTele WHERE iDMob=1"; sqlite3_stmt *statement1; if (sqlite3_prepare_v2(_database, [ZaprosTelefons UTF8String], -1, &statement1,

ios app crash on startup

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I started using crashlytics for my iphone app, and it seems that it crashes for some users during startup (or what I am guessing is startup). Here is the stack trace: Fatal Exception: NSInvalidArgumentException -[NSNull rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x19687eba0 Thread : Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x00000001854aa59c __exceptionPreprocess + 132 1 libobjc.A.dylib 0x0000000195bfc0e4 objc_exception_throw + 60 2 CoreFoundation 0x00000001854b1664 __methodDescriptionForSelector 3

NSString property copy or readonly?

ⅰ亾dé卋堺 提交于 2019-12-03 08:45:58
问题 I see many discussions saying that I should use copy for NSString property because it will prevent others from changing it behind my back. But then why don't we just set readonly property for it? Update Thanks for answering my question. But the thing is that for NSString property, you always don't want others to modify it, right? You may modify it yourself but definitely not others. I guess most of time NSString get its initial value set up (either by you or by others), after that only you

NSString stringWithContentsOfURL is deprecated. What should I do?

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've written some code that uses stringWithContentsOfURL , but it turns out that it is now deprecated. Can you help me replace it? Here's my code: NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]]; NSArray *listItems = [locationString componentsSeparatedByString:@","]; Additionally, can someone have some sample code to show how it works? What encoding was the original code done in (in my 2 lines above)? I want to maintain compatibility so what should I choose for the encoding? What does error mean

NSPredicate versus NSString: Which is better/faster for finding superstrings?

两盒软妹~` 提交于 2019-12-03 08:40:25
I have a large number of strings that I'm searching to see if a given substring exists. It seems there are two reasonable ways to do this. Option 1: Use the NSString method rangeOfSubstring and test whether .location exists: NSRange range = [string rangeOfSubstring:substring]; return (range.location != NSNotFound); Option 2. Use the NSPredicate syntax CONTAINS : NSPredicate *regex = [NSPredicate predicateWithFormat:@"SELF CONTAINS %@", substring]; return ([regex evaluateWithObject:string] == YES) Which method is better, or is there a good Option 3 that I'm completely missing? No, I'm not sure

How to Convert NSString into CGPoint in iPhone

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am getting the values from UITextfield into NSString , need to convert the values of NSString into CGPoint, Suppose if i enter 6,5 into textfield it should covert it into CGPoint. 回答1: See CGPointFromString (documentation in link). The string has to be in the format {x,y} so you would need to add those to the user input yourself: CGPoint myPoint = CGPointFromString ([ NSString stringWithFormat :@ "{%@}" , textField . text ]); Will return CGPointZero if the string is invalid. 转载请标明出处: How to Convert NSString into CGPoint in iPhone

Retrieving a filename for an ALAsset

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How can the filename be extracted from an ALAsset? Is there a way to get this via the url or some other way? 回答1: Update : As yeonsh notes below, from iOS 5.0 there is a better way. This answer is relevant for iOS < 5.0. You can extract an URL from the ALAsset, but all the filenames are the same, on the form assets-library://asset/asset.JPG?id=1000000001&ext=JPG If you for some reason need different file names, try making an internal-external paradigm: #import @interface NSURL ( NSURL_Asset ) - ( NSURL *) toExternalForm ; - ( NSURL

How to pass the NSString from One UIViewController to Another UIViewController? [duplicate]

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Possible Duplicate: iOS - Passing variable to view controller I have two Viewcontrollers (ViewController1 and ViewController2) , And i want to pass a String value along with a IBAction from ViewController1 to ViewController2. I am trying to read the NSString (*check) value in ViewController2's ViewDidLoad method, but it's returning a null value. Help me out and Thanks in advance. // ViewController1 @interface ViewController1 : UIViewController { IBOutlet UIButton * btn1 ; IBOutlet UIButton * btn2 ; NSString * check ; } #import

Webservice n sqlite

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have web services and I want to save that data in SQLite in iPhone and also want to retrieve that data. Web services include 14 parameters, also includes image URL as well. Web service is SOAP in .NET. Please help me and provide me with the complete code how to do that. 回答1: Webservices may be in Java, PHP, .NET and etc... But you have to use same procedure to make a request. Here I have given sample code to make a request and get the response from webservices. -( void ) performRequest { NSAutoreleasePool * pool = [[