121. How do I convert a dictionary/array to a string?
nsstring* Id2json (id dicorarr) {nserror *error; NSData *jsondata =[nsjsonserializationdatawithjsonobject:dicorarroptions:nsjsonwritingprettyprinted//Pass 0 if you Don ' t care about thereadability of the generated stringerror:&error];if (! Jsondata) {DLog (@ "Got an error:%@", error); return nil;} else {nsstring *jsonstring =[[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding];return jsonString;}}
122. Xcode 6.1 Gm,audiotoolbox cannot be used
In general, we are accustomed to using audiotoolbox to play short sound effects in our programs, such as this code, which is available in Xcode 6.0, but causes a compilation error on the Xcode 6.1 GM:
func playsystemsound (soundname:string) {//tink.cafletsoundpath:string= "/ system/library/audio/uisounds/"+soundnamevar Soundid:systemsoundid = 0ifnsfilemanager.defaultmanager (). Fileexistsatpath (Soundpath) {Let Soundurl =nsurl (Fileurlwithpath:soundpath) Audioservicescreatesystemsoundid ( Soundurl as Cfurl, &soundid) Audioservicesplaysystemsound (Soundid)}}
Simply replace the Audioservicescreatesystemsoundid (Soundurl as Cfurl, &soundid) with:
Audioservicescreatesystemsoundid (Soundurl, &soundid)
123, after upgrading to Yosemite, Xcode6 cannot run the simulator
After upgrading to Yosemite, all emulators in the Schema disappear, as shown in the emulator column with only IOS Device:
At this point, the APP cannot run on the emulator.
The workaround is to open the emulator (method: Xcode-and open Developer Tool--IOS), which will pop up a unable to determine device error, no tube, click OK. In the emulator menu, Hardware, device->manage Devices ..., the list of devices pops up. Click the + button in the lower left corner to add the desired simulator, then click Create, as shown in:
124. An error occurred when integrating Alamofire: only supported on IOS 8.0 Andlater
Set the Alamofire deployment target to be the same as the master project.
125. Error: Must register a nib or a class for the identifier
When building UITableViewCell using programming methods, you need to register the xib of the UITableViewCell. In the Viewdidload method, add the following sentence:
[Self.yourtableviewname registernib:[uinibnibwithnibname:@ "Yournibname" bundle:nil]forcellwithreuseidentifier:@ " Youridentifierforcell "];
If UITableViewCell does not use Xib, but the UITableViewCell has a custom. m/.h file, use the following sentence instead:
[Self.tableview Registerclass:[uitableviewcell class]forcellreuseidentifier::@ "Cell"];
126. Error undefined symbols for architecture armv7
If you have this error in a real machine debug, there is no such error in the emulator. Indicates that there is a Lib library with only the x86 version, and the ARMV7/ARMV6 version is missing. Review the library that the error points to, and use the Lipo–info command to check the binary information for the. a file.
If the armv6/armv7 version of the. A file is missing, recompile a armv7/armv6. A file to be added to the project.
You can also use the Lipo–create–output command to fuse two versions of. A files into a generic version. A file is put into the project.
Also, you may need to check the library Search path settings to see if the path to the. A file is pointing correctly.
127. Error type ' String ' does not conform to protocol ' Intervaltype '
When the switch statement is in the string? This error occurs when a match is made. For example:
Switch Item.name {case "arrives on site time": Cellitems.append (item) Default:break}
Modify the following statement to resolve this error:
If let name = Item.name{switch name {case "arrives on site time": Cellitems.append (item) Default:break}}
128, pod update often error occurred: Attempt to read nonexistent folder
Cocoapod server is wall, please use proxy or VPN (recommended VPN).
129. Viewcontroller class declaration error: Initializer ' init (coder:) ' must be provided by a subclass of Uiviewcontroller
There is a property declaration in your viewcontroller that does not give an initial value and is not marked as nullable. such as Varkpickerviewsize:cgsize, can be modified to Var kpickerviewsize:cgsize? This error can be eliminated
130. How to get all the keys of dictionary in Swift?
The AllKeys property can be used in nsdicationary, and the Keys property is used in dictionary:
Let array:[string] = [String] (Dictionary.keys)
The above is the iOS Development Hundred questions (10) content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!