Hi All,I am facing error while trying to parse json from a URL.Following is the code:override func viewDidLoad() { super.viewDidLoad() print(hello) let url=NSURL(string:http://jsonReports/sample_testkrtk252.json) print(hello2) if let allContactsData=NSData(contentsOfURL:url!) { print(allContactsData) do{ let allContacts: AnyObject! = try NSJSONSerialization.JSONObjectWithData(allContactsData, options: NSJSONReadingOptions.MutableContainers) print(allContacts) if let json = allContacts as? Array<AnyObject> { print(json) for index in 0...json.count-1 { let data12 : AnyObject? = json[index] print(data12) let collection = data12! as! Dictionary<String, AnyObject> print(collection) print(collection[data11]) let data11 : AnyObject? = collection[data11] let cont : AnyObject? = collection[cont] data1.append(data11 as! String) data2.append(cont as! String) print(data1) print(data2) } } } catch { print(error) } }And after the successful run i gives the following output:hellohello2<7b0d0a20 20202022 72656
Search results for
NSCocoaErrorDomain
1,063 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi, just want to share my experiences with push (remote notifications) and potentially get some feedback.I just noticed that my app can not get a token when build with Xcode 6 using commandline tools and the app is running on iOS 8 or below.I get the following Error:<Warning>: No valid 'aps-environment' entitlement string found for application 'myApp': (null). Notifications will not be delivered. myApp[571] <Warning>: Failed to register for remote notifications. Reason: Error Domain=NSCocoaErrorDomain Code=3000 ...I use the following command line calls to build:xcodebuild -workspace ... -scheme ... -sdk iphoneos -configuration Release CODE_SIGN_RESOURCE_RULES_PATH='$(SDKROOT)/ResourceRules.plist' CONFIGURATION_BUILD_DIR=... ARCHS='...' CODE_SIGN_IDENTITY='...' PROVISIONING_PROFILE='...' OTHER_CODE_SIGN_FLAGS='--keychain ...' -archivePath '...' archivexcodebuild -exportArchive -exportFormat ipa -archivePath '...' -exportPath '...' -exportWithOriginalSigningIdentity -verboseUsing Xcode 7.1
How about adding a function to ErrorType enum that would construct an NSError with an underlying error?enum DocumentError: ErrorType { case CantSave func withUnderlying(error: ErrorType?) -> NSError { guard let error = error else { return self as NSError } let info = [NSUnderlyingErrorKey: error as NSError] return NSError(domain: _domain, code: _code, userInfo: info) } } let cocoaError = NSError(domain: NSCocoaErrorDomain, code: NSFileWriteFileExistsError, userInfo: nil) let error = DocumentError.CantSave.withUnderlying(cocoaError)
Topic:
Programming Languages
SubTopic:
Swift
Tags:
I’m not entirely sure what you mean by “nested json” but I suspect that you’re asking how to parse a dictionary within a dictionary. If so, here’s an example.Let’s start with JSON data like this:7b0a2020 22616464 72657373 22203a20 7b0a2020 2020227a 6970436f 64652220 3a202239 35303134 222c0a20 20202022 73747265 65744164 64726573 7322203a 20223120 496e6669 6e697465 204c6f6f 70222c0a 20202020 22636f75 6e747279 22203a20 22555341 220a2020 7d2c0a20 20226e61 6d652220 3a202241 70706c65 20496e63 2e220a7dAs text this looks like this:{ address : { zipCode : 95014, streetAddress : 1 Infinite Loop, country : USA }, name : Apple Inc. }You parse out the name and country like this:do { let rootUntyped = try NSJSONSerialization.JSONObjectWithData(data, options: []) guard let rootDict = rootUntyped as? NSDictionary else { throw NSError(domain: NSCocoaErrorDomain, code: NSFileReadCorruptFileError, userInfo: nil) } guard let name = rootDict[name] as? String else { throw NSError(domain: NSCocoaErrorDomain, code:
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Hey,Has anyone recently had this issue with an AppSandbox OSX Game. The error that is shown is the following:Could not get services from gamed. Please file a radar including GameKit logs, and any gamed crash logs. ERROR Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named com.apple.gamed.osx was invalidated. UserInfo={NSDebugDescription=The connection to service named com.apple.gamed.osx was invalidated.}I found a reference to someone having this issue back in Yosemite. So I'm guessing people have submitted Game Center OSX apps since then.http://stackoverflow.com/questions/29295423/osx-game-center-couldnt-communicate-with-a-helper-applicationJust to clarify:- OSX Game- Game Center Enabled- Game Center Setup in iTunes connect and the Provisioning Profile.- Entitlement App Sandbox = YES- Entitlement set to com.apple.security.network.client = YES (and in iTunes Connect)Anyone have any ideas or tips? I'm hoping it is a missing setting somewhere...
Hello,I've just implemented game centre in a small apple TV app.The first time it ran giving me a game center signin page.It then fails with this message2015-11-23 20:42:28.157 Star Fighter Mayhem[21388:5535458] Could not get services from gamed. Please file a radar including GameKit logs, and any gamed crash logs. ERROR Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.gamed UserInfo={NSDebugDescription=connection to service named com.apple.gamed}Just wondering if anyone else has seen this, before I post a radar.This is my complete log - with other weird error messages as well.2015-11-23 20:42:27.921 Star Fighter Mayhem[21388:5535229] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found. Did find: /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugi
Hi,when I add @obj(Document) in NSDocument Class definition, I get the following execution error message2015-11-25 12:17:41.169 Lesson 20 Grades[11222:4817041] The com.mycompany.Lesson_20_Grades type doesn't map to any NSDocumentClass.2015-11-25 12:17:41.170 Lesson 20 Grades[11222:4817041] -[NSDocumentController openUntitledDocumentOfType:andDisplay:error:] failed during state restoration. Here's the error:Error Domain=NSCocoaErrorDomain Code=256 The file couldn’t be opened.
Topic:
Programming Languages
SubTopic:
Swift
Tags:
As part of the iOS 9 ATS changes I'm updating an app to use SFSafariViewController for third-party http websites.When I init and present the instance all I get is a blank white view. No navigation bar, no content..nothing at all. This happens on both device (iOS 9.1) and simulator (iOS 9.1). However on device I get the following debugger message after a minute or so:Failed to get remote view controller with error: Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named com.apple.uikit.viewservice.com.apple.SafariViewService was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid. UserInfo={NSDebugDescription=The connection to service named com.apple.uikit.viewservice.com.apple.SafariViewService was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}The app correctly includes the SafariServices framework. I created a test project to see whether it's possible my SDK installa
Hey guys,I cannot debug my WatchKit App via Xcode, it is constantley stuck at loading screen. When I remove my app in the Watch App on my Phone and then install the WatchApp again the app starts.Device logs:Dec 3 12:00:54 My-AppleWatch companion_proxy[107] <Notice>: CompanionProxy: -[CPXIDSRelayGizmo handleConnection:socket:localPort:serviceName:]:85 (0x0x1f1ac000): Starting connection on port 62078 Dec 3 12:01:05 My-AppleWatch streaming_zip_conduit[154] <Warning>: LaunchServices: installing app for existing placeholder <LSApplicationProxy: 0x17d9e450> appid.watchkitapp <(null) *Not found in database*> Dec 3 12:01:05 My-AppleWatch streaming_zip_conduit[154] <Warning>: LaunchServices: Not creating progress for <LSApplicationProxy: 0x17d9e450> appid.watchkitapp <(null) *Not found in database*> since it is not a placeholder. Dec 3 12:01:05 My-AppleWatch installd[35] <Notice>: 0x1f124000 -[MIClientConnection installPath:withOptions:completion:]: Install of /var/mobi
Dec 3 12:10:53 My-AppleWatch iap2d[93] <Warning>: process com.apple.stocks.watchapp.watchextension is now suspending Dec 3 12:10:53 My-AppleWatch gizmoappd[95] <Warning>: Hub connection error Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named appid.watchkitapp.watchkitextension was invalidated. UserInfo={NSDebugDescription=The connection to service named appid.watchkitapp.watchkitextension was invalidated.} Dec 3 12:10:53 My-AppleWatch gizmoappd[95] <Notice>: (Error) WatchKit: <SPGizmoPlugInManager.m __72-[SPGizmoPlugInManager beginUsingExtension:serverIdentifier:completion:]_block_invoke:972> could not activate plugin appid.watchkitapp.watchkitextension (error:Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named appid.watchkitapp.watchkitextension was invalidated. UserInfo={NSDebugDescription=The connection to service named appid.watchkitapp.watchkitextension was invalidated.}) Dec 3 12:10:53 My-AppleWatch gizmoappd[95] <
Topic:
App & System Services
SubTopic:
General
Tags:
It's strange the I have the same code in 2 applications. In one application UIDocumentMenuViewController opens up with no applications EVERY OTHER TIME, while there are no such issues in my other application. I looked into the logs. Everytime my first application fails to show other document provider application here's the errorRemote view controller error while displaying UIDocumentMenuViewController: Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.UIKit.fileprovider.default.viewservice UserInfo={NSDebugDescription=connection to service named com.apple.UIKit.fileprovider.default.viewservice}I tried to look up as much as I could tried to run everything with delay, in main queue, nothing works. Any help will be much appreciatedMy original code to show DocumentMenuViewController is pretty straight forward, as one would expectlet menu = UIDocumentMenuViewController(documentTypes: [kUTTypeContent as String], inMode: UIDocumentPickerMode.Import)menu.delegate = selfself.pres
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Provisioning Profiles
Error Domain=NSCocoaErrorDomain Code=3840 JSON text did not start with array or object and option to allow fragments not set. UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}Here is my code:let myUrl = NSURL(string: http://www.01coders.com/ios/userRegister.php); let request = NSMutableURLRequest(URL : myUrl!); request.HTTPMethod = POST; let postString = username=(username)&password=(password); request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding); let task = NSURLSession.sharedSession().dataTaskWithRequest(request){ data, response, error -> Void in if (error != nil){ print(error=(error)) return } do{ let json = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.AllowFragments) as! NSDictionary print(json: (json)); let resultValue = json[status] as! String; print(Result: (resultValue)) var isUserRegistered:Bool = false; if(resultValue==Success){ isUserRegistered = true; } var messageTod
I try to follow the implementation guidelines as per https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/OTASecurity/OTASecurity.html#//apple_ref/doc/uid/TP40009505-CH3-SW7Authentication for step 1 works, so Apple devices sends the request to my webserverThe webserver signs the .mobileconfig and sends it back.The Apple device receives the config, asks for installation from the user on the Apple device. User clicks Install.The webserver receives a request for the device encryption and sends back the data with SCEP specification as per https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/ConfigurationProfileExamples/ConfigurationProfileExamples.html#//apple_ref/doc/uid/TP40009505-CH4-SW6This request does not seem to be arriving to the SCEP server at all, rather the Apple device shows:Profile installation failed.The profile “(website.com:UUID)” could not be installed due to an unexpected error.<NSCocoaErrorDomain
Unable to download an CKAsset, I find maybe cause I uploaded it using the dashboard. Now I find I am unable to upload a CKAsset with this code either. Obviously the recordIDs listed here have been changed. NSArray *germanMakes = @[@963ad20a-756b-I-A-X]; NSArray *moduleMakes = @[@33ef0a6b-013d-J-B-Y]; NSMutableArray *localChanges = [NSMutableArray array]; for (int i=0; i<[germanMakes count]; i++) { CKRecordID *wellKnownID = [[CKRecordID alloc] initWithRecordName:germanMakes[i]]; CKRecord *record = [[CKRecord alloc] initWithRecordType:@Slides recordID:wellKnownID]; record[@fullName] = [NSString stringWithFormat:@Week %d,i]; record [@presentationReference] = [[CKReference alloc] initWithRecordID:moduleMakes[i] action:CKReferenceActionDeleteSelf]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths firstObject]; NSString *slideName = [NSString stringWithFormat:@slide%d,i]; // slide01 name of asset.xcassets NSString *fullPath =
To Whom It May Concern:I apparently have a self propagating virus that was introduced to my network by purchase of a used Mac computer from Amazon.com on approximately December 24, 2015. That is when I first started noticing erratic behavior on my machines. I have clean formatted and reinstalled OS from computers on an isolated network that was not infected. As soon as I connect the newly reinstalled OS iMacs to the infected network they become reinfected on first boot. I've spent something like 40 labor hours on this so far and I can't afford anymore resource allocation to this issue until there are some steps to cure the system.This activity on my computer appears to be a nasty virus. From what I can tell, it tries injecting itself in every executable it can locate. It trys to obtain the icloud login credentials, it attempts to obtain administrator credentials, and on one computer it appears to have secured and stolen my credentials to completely hijack the computer. Once it hijacks the computer it deletes