Home Backend Development PHP Tutorial iOS development questions (1)

iOS development questions (1)

Jan 20, 2017 am 09:23 AM

1. Set the size of ImagePicker
ImagePicker is always displayed at the default size in Popover Controller, and setting the popoverContentSize attribute seems useless. The solution is to "include" the ImagePicker into a custom ViewController, and then presentPopover this ViewController:

UIViewController *containerController = [[UIViewController alloc] init];
containerController.contentSizeForViewInPopover = CGSizeMake(600,self.view.frame.size.height);
[containerController.viewaddSubview:_imagePicker.view];
_popController= [[UIPopoverController alloc] initWithContentViewController:containerController];
CGPoint p=[self.view convertPoint:button.center
fromView:sender.superview];
[_popController presentPopoverFromRect:(CGRect){p,CGSizeZero}
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
[_imagePicker.view setFrame:containerController.view.frame];// 很重要
Copy after login

Note that the width of the popover is at most 600. In addition, _imagePicker must be init once before each presentPopoverFromRect, otherwise the display position will be incorrect.
2. The problem of garbled Chinese file names in uploaded files
Use URL Encode to encode the file name on the iOS client, and then use URL Decode to decode it on the server.
Client:

NSStringEncodingenc=NSUTF8StringEncoding;
[request setData:datawithFileName [filename stringByAddingPercentEscapesUsingEncoding:enc]
andContentType:@"application/octet-stream" forKey:key];
Copy after login

Server:

String filename=request.getParameter(“upload_file”);
filename=URLDecode.decode(s,”utf-8”);
Copy after login

3, Mac 64 bit Device
Sometimes after updating the project from SVN, Scheme will be displayed as Mac 64 bit Device and does not allow running programs. At this time, you only need to reset the DeploymentTarget of Target (set to simulator or debugging device).
4. Remove the NSLog of the debugger
The compilation parameter Optimize Level is set according to different versions. For example, the Debug version is None, and the Release version is Fastest, Smallest. In this way, we can redefine the NSLog function based on this parameter:

#ifndef __OPTIMIZE__
#define NSLog(...)NSLog(__VA_ARGS__)
#else
#define NSLog(...) {}
#endif
Copy after login

5. Warning: no previous prototye for function
According to the c specification, if the function has no parameters, use void as the function parameter.
The function declaration should use "void functionA(void);" instead of "void functionA();".
6. Array sorting
Method 1:

- (NSComparisonResult)compare:(Person *)otherObject {
return [self.birthDatecompare:otherObject.birthDate];
}
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingSelector:@selector(compare:)];
Copy after login

Method two:

NSSortDescriptor *sortDescriptor;
sortDescriptor = [[[NSSortDescriptor alloc]initWithKey:@"birthDate"
ascending:YES] autorelease];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingDescriptors:sortDescriptors];
Copy after login

Method three (10.6+):

NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingComparator:^(id a, id b) {
NSDate *first =[(Person*)a birthDate];
NSDate *second =[(Person*)b birthDate];
return [firstcompare:second];
}];
Copy after login

7. Where is the build directory of Xcode 4?
Xcode 4 has made many changes. You won't be able to find the build directory, and you won't be able to find the Products file group. So where does it put the executable file generated after the project is compiled? The answer is the "{USERNAME}/Library/Developer/Xcode/DerivedData/{PROJECT_NAME_AND_RANDOM_CRAP}/Build/Products/{BUILD_TYPE}/{PROJECT_NAME}.app" directory.
8. Warning: no rule to process file
Xcode attempts to detect each file type. When it thinks a file is of type "source file" (such as a .js file), it always tries to add it to Compile Sources and tries to compile it. The solution to this warning is to move such files from the Compile Sources of Build Phases to Copy Bundle Resources.
9. Warning: 'initWithFrame:reuseIdentifier:'is deprecated
This method will be abandoned in subsequent versions. Please use
- initWithStyle:reuseIdentifier:
10, itms-services does not work
itms-services is recognized by apple/iphone as a special word, it will verify the certificate specified in the provisioning profile and install it .
Before installing this .ipa file, verify the profisioning profile, which will be connected to "ax.init.itunes.apple.com" and "ocsp.apple.com".
If you are on an intranet, please check whether the above address is accessible. If not, you won't be able to use OTA to install the app. Requires iOS 4.0 or above.
Note: Inability to access the above address will not affect the installation. However, iOS will check whether the certificate is legal through the above address at runtime. If the installation is legal, iOS will cache the check results (7 days).

The above is the content of iOS development questions (1). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The first version of Apple's iOS 18 was exposed to have so many bugs: serious fever, WeChat delay The first version of Apple's iOS 18 was exposed to have so many bugs: serious fever, WeChat delay Jun 13, 2024 pm 09:39 PM

The annual WWDC has ended, and iOS18 is undoubtedly the focus of everyone's attention. Currently, many iPhone users are rushing to upgrade to iOS18, but various system bugs are making people uncomfortable. Some bloggers said that you should be cautious when upgrading to iOS18 because "there are so many bugs." The blogger said that if your iPhone is your main machine, it is recommended not to upgrade to iOS18 because the first version has many bugs. He also summarized several system bugs currently encountered: 1. Switching icon style is stuck, causing the icon not to be displayed. 2. Flashlight width animation is often lost. 3. Douyin App cannot upload videos. 4. WeChat message push is delayed by about 10 seconds. 5 . Occasionally, the phone cannot be made and the screen is black. 6. Severe fever.

Apple re-releases iOS/iPadOS 18 Beta 4 update, version number raised to 22A5316k Apple re-releases iOS/iPadOS 18 Beta 4 update, version number raised to 22A5316k Jul 27, 2024 am 11:06 AM

Thanks to netizens Ji Yinkesi, xxx_x, fried tomatoes, Terrence, and spicy chicken drumsticks for submitting clues! According to news on July 27, Apple today re-released the iOS/iPadOS 18 Beta 4 update for developers. The internal version number was upgraded from 22A5316j to 22A5316k. It is currently unclear the difference between the two Beta 4 version updates. Registered developers can open the "Settings" app, enter the "Software Update" section, click the "Beta Update" option, and then toggle the iOS18/iPadOS18 Developer Beta settings to select the beta version. Downloading and installing the beta version requires an Apple ID associated with a developer account. Reported on July 24, iO

Apple releases open source Swift package for homomorphic encryption, deployed in iOS 18 Apple releases open source Swift package for homomorphic encryption, deployed in iOS 18 Jul 31, 2024 pm 01:10 PM

According to news on July 31, Apple issued a press release yesterday (July 30), announcing the launch of a new open source Swift package (swift-homomorphic-encryption) for enabling homomorphic encryption in the Swift programming language. Note: Homomorphic Encryption (HE) refers to an encryption algorithm that satisfies the homomorphic operation properties of ciphertext. That is, after the data is homomorphically encrypted, specific calculations are performed on the ciphertext, and the obtained ciphertext calculation results are processed at the same time. The plaintext after state decryption is equivalent to directly performing the same calculation on the plaintext data, achieving the "invisibility" of the data. Homomorphic encryption technology can calculate encrypted data without leaking the underlying unencrypted data to the operation process.

Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Aug 18, 2024 am 06:34 AM

Update: Saunders Tech has uploaded a tutorial to his YouTube channel (video embedded below) explaining how to install Fortnite and the Epic Games Store on an iPad outside the EU. However, not only does the process require specific beta versions of iO

New features of Apple's iOS 18 'Boundless Notes” app: expanded Scenes functionality, introduced grid alignment New features of Apple's iOS 18 'Boundless Notes” app: expanded Scenes functionality, introduced grid alignment Jun 02, 2024 pm 05:05 PM

According to news on June 1, technology media AppleInsider published a blog post today, stating that Apple will launch a new navigation function of "Scenes" for the "Freeform" application extension in the iOS18 system, and add new options for object alignment. Introduction to the "Wubianji" application First, let's briefly introduce the "Wubianji" application. The application will be launched in 2022 and has currently launched iOS, iPadOS, macOS15 and visionOS versions. Apple’s official introduction is as follows: “Boundless Notes” is an excellent tool for turning inspiration into reality. Sketch projects, design mood boards, or start brainstorming on a flexible canvas that supports nearly any file type. With iCloud, all your boards

Apple iOS 17.5 RC version released: allows EU iPhone users to download apps from the website Apple iOS 17.5 RC version released: allows EU iPhone users to download apps from the website May 08, 2024 am 09:30 AM

[Click here to go directly to the upgrade tutorial] According to news on May 8, Apple pushed the iOS17.5RC update (internal version number: 21F79) to iPhone users today. This update is 70 days away from the last release. How to upgrade iOS/iPadOS/watchOS/macOS development version and public beta version? To upgrade the iOS/iPadOS17 developer preview version and public beta version, you can refer to the experience shared by friends: Experience Post 1||Experience Post 2||Experience Post 3||Experience Post 4. Starting from the iOS/iPadOS 16.4 Developer Preview Beta 1, you need to register for the Apple Developer Program. After registration, open the system [Settings] [Software Update] to see the upgrade option. Please note that your iPhone or IP

Apple iOS/iPadOS 18 Developer Preview Beta 4 released: Added CarPlay wallpapers, sorted out settings options, enhanced camera control Apple iOS/iPadOS 18 Developer Preview Beta 4 released: Added CarPlay wallpapers, sorted out settings options, enhanced camera control Jul 24, 2024 am 09:54 AM

Thanks to netizens Spicy Chicken Leg Burger, Soft Media New Friends 2092483, Handwritten Past, DingHao, Xiaoxing_14, Wowotou Eat Big Kou, Feiying Q, Soft Media New Friends 2168428, Slades, Aaron212, Happy Little Hedgehog, Little Earl, Clues for the little milk cat that eats fish! [Click here to go directly to the upgrade tutorial] According to news on July 24, Apple today pushed the iOS/iPadOS18 developer preview version Beta4 update (internal version number: 22A5316j) to iPhone and iPad users. This update is 15 days after the last release. . Carplay Wallpaper Apple has added wallpapers to CarPlay, covering light and dark modes. Its wallpaper style is similar to iPhone

Should iPhone12 ios16 be updated to ios17.5beta3? How is the experience of ios17.5beta3? Should iPhone12 ios16 be updated to ios17.5beta3? How is the experience of ios17.5beta3? Apr 25, 2024 pm 04:52 PM

Practical sharing... As Apple continues to launch new iOS versions, many iPhone users are faced with the choice of whether to upgrade the system. The release of the latest iOS17.5Beta3 has attracted widespread attention, especially for iPhone12 users. Whether they should abandon the existing iOS16 and try the new Beta version has become a question worth discussing. Based on actual experience, this article analyzes the pros and cons of upgrading iPhone 12 to iOS 17.5 Beta 3 to provide a reference for the majority of Apple fans. First of all, we need to make it clear that Beta versions are usually used by developers or early adopters who are willing to take a certain risk. This means that compared to the official version, the Beta version may contain

See all articles