Questions about iOS development (10)

Source: Internet
Author: User
If this error occurs during debugging on the real machine, it is not found in the simulator. It indicates that a lib library only has the x86 version, but the armv7armv6 version is missing. View the database pointed to by the error and use the lipo-info command to check the binary information of the. a file. 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 unavailable
Generally, we are used to playing short sound effects using AudioToolbox in programs. for example, this code is available in Xcode 6.0, but a compilation error occurs on 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)}}

Replace AudioServicesCreateSystemSoundID (soundURL as CFURL, & soundID):
AudioServicesCreateSystemSoundID (soundURL, & soundID)
123 Xcode6 cannot run the simulator after being upgraded to Yosemite
After being upgraded to Yosemite, all simulators in the Schema disappear, as shown in. the simulator column contains only iOS devices:



In this case, the App cannot run on the simulator.
Solution: Open the simulator (method: Xcode-> Open Developer Tool-> iOS). an Unable to determine device error is displayed. click OK. In the simulator menu, choose Hardware> Device> Manage Devices ..., The device list is displayed. Click the + button in the lower left corner to add the required simulator, and then click Create, as shown in:



124. An error occurred while integrating Alamofire: only supported on iOS 8.0 andlater
Set the deployment target of Alamofire to be the same as the main project.

125 error: must register a nib or a class for the identifier
When you build a UITableViewCell using a programming method, you must register the xib of the UITableViewCell. Add the following sentence to the viewDidLoad method:

[self.yourTableViewName registerNib:[UINibnibWithNibName:@"YourNibName" bundle:nil]forCellWithReuseIdentifier:@"YourIdentifierForCell"];

If the UITableViewCell does not use xib, but the UITableViewCell has a custom. m/. h file, replace it with the following sentence:

[self.tableView registerClass:[UITableViewCell class]forCellReuseIdentifier::@"Cell"];

126 error Undefined symbols for architecture armv7
If this error occurs during debugging on the real machine, it is not found in the simulator. It indicates that a lib library only has the x86 version, but armv7/armv6 version is missing. View the database pointed to by the error and use the lipo-info command to check the binary information of the. a file.
If the. a file of armv6/armv7 is missing, recompile a. a file of armv7/armv6 and add it to the project.
You can also use the lipo-create-output command to combine the. a files of the two versions into a general version. a file and put it into the project.
In addition, you may also need to check the Library Search Path settings to see if the Path to the. a file is correct.
127 error Type 'string' does not conform to protocol 'intervaltype'
In the switch statement? This error occurs when matching. For example:

Switch item. name {case "arrival time": cellItems. append (item) default: break}

The following statement can solve this error:

If let name = item. name {switch name {case "arrival time": cellItems. append (item) default: break }}

128 errors frequently occur during pod update: Attempt to read nonexistent folder
The cocoapod server is walled. use a proxy or VPN (VPN recommended ).

129 ViewController class declaration error: initializer 'init (coder :) 'must be provided by a subclass of UIViewController
When your ViewController has an attribute declaration, the initial value is not assigned and it is not marked as void. For example, varkPickerViewSize: CGSize can be changed to var kPickerViewSize: CGSize? This error can be eliminated.

130. how to obtain all keys of a Dictionary in Swift?
You can use the allKeys attribute in NSDicationary and the keys attribute in Dictionary:

let array:[String] = [String](dictionary.keys)



The above is the content for iOS development FAQ (10). For more information, see PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.