1, upload file Chinese file name garbled problem
The iOS client encodes the file name with the URL encode and then decodes it with the URL decode on the server.
Client:
nsstringencodingenc=nsutf8stringencoding;
[Request Setdata:datawithfilename [filename Stringbyaddingpercentescapesusingencoding:enc]
andcontenttype:@ "Application/octet-stream" Forkey:key];
Service side:
String filename=request.getparameter ("Upload_file");
Filename=urldecode.decode (S, "utf-8");
2. Mac bit Device
Sometimes when a project is updated from SVN, scheme is displayed as a Mac-bit Device, and the program is not allowed to run. Just re-set the target's DeploymentTarget (set as emulator or debug device).
3, remove the NSLog of the debugging program
The compile parameter optimize level is set according to the different version. For example, the debug version is None, for release version is fastest,smallest. In this way, we can redefine the NSLog function according to this parameter:
#ifndef __optimize__
#define NSLOG (...) NSLog (__va_args__)
#else
#define NSLOG (...) {}
#endif
4, set the size of the Imagepicker
Imagepicker The Popover Controller is always displayed at the default size, it seems useless to set the Popovercontentsize property. The solution is to "include" Imagepicker in a custom Viewcontroller, and then presentpopover the 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];//is important
Note that the width of the popover is up to 600. In addition, _imagepicker must be init one time before each presentpopoverfromrect, otherwise the display location is incorrect.
5. Warning: No previous prototye for function
According to the C specification, if the function has no arguments, void is used as the function argument.
The function declaration should use "void Functiona (void);" Instead of "void Functiona ();".
6. Array sorting
Method One:
-(Nscomparisonresult) Compare: (Person *) Otherobject {
return [self.birthDatecompare:otherObject.birthDate];
}
Nsarray *sortedarray;
Sortedarray = [Drinkdetails sortedarrayusingselector: @selector (compare:)];
Method Two:
Nssortdescriptor *sortdescriptor;
Sortdescriptor = [[[Nssortdescriptor alloc]initwithkey:@ "BirthDate"
Ascending:yes] autorelease];
Nsarray *sortdescriptors = [Nsarray arraywithobject:sortdescriptor];
Nsarray *sortedarray;
Sortedarray = [Drinkdetails sortedarrayusingdescriptors:sortdescriptors];
Method Three:
Nsarray *sortedarray;
Sortedarray = [Drinkdetails sortedarrayusingcomparator:^ (id A, id b) {
NSDate *first =[(person*) a birthDate];
NSDate *second =[(person*) b birthDate];
return [Firstcompare:second];
}];
7. Where is the build directory for Xcode 4? (Older questions, estimates will not be used!) )
Xcode 4 makes a lot of changes. You will not be able to find the build directory, nor can you find the products filegroup. So where does it put the executable files that were generated after the project was compiled? The answer is "{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 tries to detect the type of each file. When it thinks that a file belongs to a "source file" type (such as a. js file), it always tries to add it to the 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 the Copy Bundle resources.
9. Warning: ' initwithframe:reuseidentifier: ' is deprecated
This method will be discarded in subsequent releases. Please use
-Initwithstyle:reuseidentifier:
10. Itms-services not working
Itms-services is recognized by Apple/iphone as a special word that verifies and installs the certificate specified in the provisioning profile.
Before installing this. IPA file, verify the Profisioning profile, which connects to "ax.init.itunes.apple.com" and "ocsp.apple.com".
If you are on an intranet, check to see if you can access the above addresses. If not, you will not be able to use OTA to install the application. Requires iOS 4.0 or more.
Note: The above address cannot be accessed and does not affect the installation. However, iOS will check the validity of the certificate at run time through the above address, and if the installation is legitimate, iOS will cache the check result (7 days).
iOS interview (9)