Search results for

Request failed with http status code 503

190,876 results found

Post

Replies

Boosts

Views

Activity

Any way to combine try with as?
I had some 1.2 code that got converted to 2.0 today. However, it appears I need to add more indention to handle it. Not sure if there is a better way:do { let orders = try NSJSONSerialization.JSONObjectWithData(d, options: NSJSONReadingOptions()) if let orders = orders as? [[String: AnyObject]] { ...I use to have a single if let ... statement here where I combined asking for the jsonObject with as? [[String: AnyObject]]Is there a better way to do this or is what I have here the right way to do it?
3
0
433
Jun ’15
How to ignore errors?
First of all, let me just go out and say that this new error handling system in Swift is a huge, huge improvement. However, this is one case that I'm unsure about, which is when you legitimately care about errors. However, sometimes you don't care about the specific error, but you just want to know if something succeeds or not. A good example is checking the availability of a file, where you just want to know if it's reachable and don't want to bomb out if it's not. In Objective-C, this would be done with one line of code, simply by passing NULL for the error parameter:BOOL isReachable = [someURL.checkResourceIsReachableAndReturnError: NULL];However, in Swift 2, the best way I can see to do this is:let someURL = ... let isReachable: Bool do { try someURL.checkResourceIsReachableAndReturnError() isReachable = true } catch { isReachable = false }This seems somewhat verbose and awkward. Is there any more elegant way just to check if a file is reachable without treating the result as an error?
7
0
3.7k
Jun ’15
Unable to Generate call on Watch OS 2
NSString *phoneNumberString = @tel:1234567891;NSURL *phoneURL = [NSURL URLWithString:phoneNumberString];[[WKExtension sharedExtension]openSystemURL:phoneURL];This is the code I'm using to try to generate a phone call on the watch. I am unable to debug when using the device and It's not possible to generate a call on the simulator, but I do hit the breakpoint on the simulator. I don't see what is wrong. Can anyone see a problem or help? Thanks.
3
0
805
Jun ’15
Reply to How to ignore errors?
In the Swift 2 Prerelease for the Swift book, it states:“There are some cases in which you know a throwing function or method won’t, in fact, throw an error at run time. In these cases, you can call the throwing function or method in a forced-try expression, written, try!, instead of a regular try expression.Calling a throwing function or method with try! disables error propagation and wraps the call in a run-time assertion that no error will be thrown. If an error actually is thrown, you’ll get a runtime error.”https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html#//apple_ref/doc/uid/TP40014097-CH42-ID508(there is no way to deep-link to the relevant section but it's the second from last, Disabling Error Propagation.)If you have a chance to watch the video posted on the developer site from the What's new in Swift session, it's well worth it. I think that's where I saw this.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’15
watchOS 2 framework failing
I am using a custom embedded framework to make my watch extension currently work. However, when I use Xcode 7 with watchOS 2, I get a bunch of warnings, one of which offers to Update to recommended settings. Has anyone else gotten this?When I click Perform changes to update to the recommended settings, all the lines #import <MyFramework/MyFramework.h> in my watch extension interface controller files say file not found. I have checked to make sure that I am linking with the library MyFramework in the app extension, but this error still appears. Again, I wasn't having this issue prior to Xcode 7.Any help would be greatly appreciated. Thanks!Edit: I tried creating a brand new project with an Apple Watch app+extension. I created a custom framework and linked to it in my watch extension, but this error still shows up. So I don't think it has to do with the recommended settings...
5
0
5.3k
Jun ’15
Altimeter and required device capabilities
We're developing an app that requires that the device has altimeter present. Currently there is no way of targeting such devices with required device capabilities as iPhone 5S supports everything 6 & 6 Plus does (and it would be wrong anyway). Sure we could test it in code, but it would be unpleasant for the user to purchase the app only to discover that the key feature does not work on her device.Is there a plan to add this capability to the requirements or is there something else we haven't thought about?
1
0
1k
Jun ’15
How can I clear the network requests and responses left in the device memory?
I'm using AFNetworking as my basic networking library. When I do a memory dump on a jailbroken phone (iPhone 4, iOS 7.1), I can easily see request urls and/or responses (such as json objects) in the dump files in plain text. I checked with the memory leak tool in Xcode and there is no memory leak based on that.My app has sensitive data in the urls or responses (Like user's name, email address, etc), which are listed in the OWASP mobile risks (M4: Unintended Data Leakage). We are required to be in compliance with these standards so I want to clean this information right after the connection finished. What I have done so far:1) Set the cache policy in the AFNetworking to NSURLRequestReloadIgnoringLocalCacheData2) Disabling the NSURLCache in the app:NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; [NSURLCache setSharedURLCache:sharedCache];3) I also tried:[[NSURLCache sharedURLCache] removeAllCachedResponses];or[[NSURLCache sharedURLCache] removeCached
3
0
2.2k
Jun ’15
Reply to Photos crashing
Same issue - Mid 2010 MBP.Application Specific Information:Assertion failed: (ctx), function CIEAGLContextCreate, file /Library/Caches/com.apple.xbs/Sources/CoreImage/CoreImage-327.6/Framework/misc/CIEAGLContext.m, line 261.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’15
Bluetooth with AVAudioSessionPlaybackAndRecord
Hello!I am working on an app that plays audio and accepts voice commands simultaniously. When I play audio through bluetooth in my car, the Audio Session for the app uses the Bluetooth HFP ports. This causes the output audio quality to become very poor. If I switch to AVAudioSessionPlayback, the output is on the A2DP port, which sounds great. Ideally I would like to be able to play ouput through A2DP, and accept input through HFP, but I assume this is a limitation of bluetooth, or everything would already work this way to improve sound quality. For my app it would be acceptable to accept input from the phone's microphone, and play the audio through bluetooth, but this also seems impossible as described here: http://stackoverflow.com/questions/22146406/ios-input-mic-output-bluetooth-device. Any advice on improving playback audio quality when connected to bluetooth while using AVAudioSessionPlayback and record would be greatly appreciated. Has anyone encounted this issue before and had a suitable fix?T
3
0
4.8k
Jun ’15
MailCompositionService quit unexpectedly
I'm having an issue with mail and iOS 9. I have a button in my app that creates a MFMailCompositionViewController used for submitting feedback via email. This works fine in iOS 8. However, in the iOS 9 simulator, whenever I push this button, a window outside of the simulator pops up saying MailCompositionService quit unexpectedly.Meanwhile, the Xcode console shows the following output:viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.) UserInfo=0x7fa3aaff02b0 {Message=Service Connection Interrupted}However, the app hasn't actually crashed. It continues to work fine. The app only crashes if I try to share something via email using UIActivityItemProvider. And when this crash happens, there's no log output other than (lldb). Is this just an issue with the simulator? I haven't tried running the app on an actual device with iOS 9.
11
0
12k
Jun ’15