Search Results

Search found 5 results on 1 pages for 'ian1971'.

Page 1/1 | 1 

  • iPhone: How to Get Basic Authentication to HTTPS Web Service Using NSURLCredential

    - by ian1971
    I am trying to call an https web service (RESTful) using basic authentication. It works fine if I put the credentials in the url itself but I would rather add it to the request so that the password does not appear, for instance in an exception. I am using the following code: NSURLCredential *credential = [NSURLCredential credentialWithUser:@"myuser" password:@"mypassword" persistence:NSURLCredentialPersistenceForSession]; NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"example.com" port:443 protocol:@"https" realm:nil authenticationMethod:NSURLAuthenticationMethodHTTPBasic]; [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace]; NSURLConnection *theConnection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; but it does not work. The didReceiveAuthenticationChallenge delegate method gets called and I can add a credential there but ideally I would send it with the request. Any ideas?

    Read the article

  • Can you update a file in the application bundle?

    - by ian1971
    Is it possible to update a file stored in an applications bundle programmatically? Basically I want to get a remote file and overwrite one of the bundle files with it (a sqlite database in fact). This works fine on the simulator but on the device it does not work, though it does not error either (it just doesn't seem to actually overwrite). I know I can work around it by copying it do the user folder instead and then getting the code to check their first for the file before using the bundle one but I was interested to know whether it is possible to update a bundle file at all or am I just doing something wrong? Thanks

    Read the article

  • Do we really need a safe release macro?

    - by Ian1971
    Quite a lot of people seem to use a macro such as #define SAFE_RELEASE(X) [X release]; X = nil; (myself included). I've been reassessing why I am using it and wanted to canvas some opinion. The purpose (I think) for using this macro is so that if you were to accidentally use your object after releasing it then you won't get a bad access exception because objective-c will quite happily ignore it when the object is nil. It strikes me that this has the potential to mask some obscure bugs. Maybe it would actually be preferable for the program to crash when you try to use X again. That way during testing you can find the issue and improve the code. Does this macro encourage lazy programming? Thoughts?

    Read the article

  • Xcode File management. What is best practice?

    - by ian1971
    I've been using Xcode for a while now. One thing that always bugs me is the way it handles files. I like to have my files all in nested folders rather than one big physical folder, but when you create a group in Xcode by default it does not create a folder just a virtual folder within the project. I can see that virtual folders are great for linking code in arbitrary places into your project but once you get beyond a few classes I find the one big folder approach really painful. And then if you try to fix it later it takes ages and is easy to break your build. Is it possible to change this behaviour so that by default it creates a physical folder? Or am I doing it wrong and trying to cling to some other way of working? How do other people work with files in Xcode?

    Read the article

1