IOS Project Problem Summary

Source: Internet
Author: User
Tags shallow copy

Item?? Problems encountered in the project

* Code Specification Question * item?? Let's learn before you start. First, pick up the mouth, write to the mouth? Document painting

Flow chart

1, IOS UTF-8 encoding (when the post upload, the Chinese character upload format is%ae this form), you can go through the next surface? method to convert.
1, nsstring* encodedstring = [urlstringstringbyaddingpercentescapesusingencoding:nsutf8stringencoding];

2.

NSString * encodedstring = (nsstring*) cfurlcreatestringbyaddingpercentescapes (Kcfallocatordefault, (CFSTRINGREF) Urlstring,null,null,kcfstringencodingutf8); 2, on the keyboard? Face view when changing the keyboard type, the frame value of the view changes in real time, you can use the notification of the heart to enter the line to observe, Change the frame of the view in real time. [[Nsnotificationcenter Defaultcenter] Addobserver:selfselector: @selector (keyboardwillchangeframe:) Name: Uikeyboardwillchangeframenotification Object:nil]; You can also set the Inputview of the keyboard. 3, in the analysis?? When the network returns data, the receiving data type does not match, for example: Return is NSNumber, receive? with NSString. 4, the problem of the array out of bounds (often see the situation is: Advanced? The statement of the network request, but the next polygon statement is immediately followed by the receive?? Network data Nsarray or Nsmutablearray), right? An array of 0 elements in the line Objectatindex: operation, resulting in an array out of bounds, to resolve? The method is to take an element from the array, the logarithm group into the row [array count] to judge; Ensure that the number of elements in the array is not 0, and then log in to the row operation. 5 、?? When the network return data is <null>, do not know how to enter the row to judge, this occurs because the back end of the data returned to the default value, can be [responsedata isequal:[nsnull Null]] into the line to determine. 6, learn from? Download the demo on the Internet, in the reference to the demo, self-written, the inexplicable collapse of the situation,? generally,?? The online demo makes use of the time arc, but learning is born in the "self-engineering", the use of the MRC, resulting in the early release of certain objects. Workaround, in Targets-build phases-compile

Sources the corresponding. m file added-fobjc-arc. If you want to make a class do not use arc then you can add-fno-objc-arc to the Targets-build phases-compile Sources corresponding. m file. 7, in the IOS7 Uinavigationcontroller in the Uitextview or Uiscrollview, the text of the alignment, the vertical direction of the alignment? The way is the center of the alignment, not the alignment, Need to be added in Viewdidlload? Face: Automaticallyadjustsscrollviewinsets

if ([[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {

}

There is also an offset when the uiscrollview is used. 8. When using Uicollectionview, the crash appears ' Uicollectionview must is initialized with a non-nil layout parameter ' because there is no in-line Initialization of the uicollectionviewflowlayout.

Solution? Method:

Uicollectionviewflowlayout *layout= [[Uicollectionviewflowlayout alloc]init]; Self.collectionview = [[Uicollectionview alloc]initwithframe:self.view.bounds collectionviewlayout:layout];

[Self.view AddSubView:self.collectionView]; [Self.collectionview Registerclass:[uicollectionviewcell class]

forcellwithreuseidentifier:@ "Cell"]; self.collectionview.delegate=self; self.collectionview.datasource=self;

Attention appears: Delegate,datasource agreement when self.collectionview.delegate=self; self.collectionview.datasource=self; corresponding in the. h?? must add: <uicollectionviewdatasource,uicollectionviewdelegateflowl ayout> 9, in the guide? When entering the Cocoahttpserver frame, the header search path is set to ${sdcroot}/usr/include/when the LIBXML2 has been directed into the

Self.automaticallyadjustsscrollviewinsets = NO; Avoid
The top Uitextview space, iOS7 (~bug?)

LIBXML2, there are 20 errors, such as unknown type name ' Xmlnodeptr ', because LIBXML2 is in the other folder??????? Into the LIBXML2 similar frame is at Targets-build phases-link Binary with Libraries, instead of under *tests. 10. An attempt to modal apart? An attempt to appear presenting view controllers on detached view controllers is discouraged <*>

11, the process of the operation of the procedure appears ' only run on the main thread! ', because the update UI is not in the main thread in the line. 12, UITableViewCell in IOS5 and IOS6 have different initialization? method, in the IOS6 of the use-(ID) Dequeuereusablecellwithidentifier: (NSString *) identifier Forindexpath: (Nsindexpath *) Indexpath to UITableViewCell in the line initialization, need to make? With the supporting-(void) RegisterClass: (Class) Cellclass Forcellreuseidentifier: (NSString *) identifier? method to register the UITableViewCell in line. 13, in the use of Baidu Map API, the first need in the appdelegate? Face set Baidu Map agent, or into the screen after the black color. 14. When using UITableView, will the section stay on the top of the screen until it slides down to the bottom? A partition, a workaround, a TableView style selection, and a custom headerview. 15, related?? Network request and UITableView when the data is displayed, the array is out of bounds, the reason is:?? The network request has not been completed, but the agent in the UITableView? Method? has already begun to make? Use arrays (for an array with an element number of 0 to tune with the Objectatindex:? method), the workaround is to use the array to determine the number of elements in the array, not 0 to enter? Line operation. 16. In the process of making use of the third party drawer effect (Ddmenu), if from center attempt to push to subordinate Viewcontroller (Aviewcontroller), then in the Aviewcontroller to use? Gestures can still return to the left view of the Ddmenu, and if you want to cancel the effect, you can temporarily turn off the ddmenu gesture in Aviewcontroller. 17. If an array is used to make a copy of the system, then copy the resulting array is an immutable array.

[Self.view.window.rootViewController
Presentviewcontroller:viewcontroller Animated:yes
Completion:nil];

18, in the class of the. h? Face, if the #import <Foundation/Foundation.h> in the next one, write code, do not? Auto-complete, and if the parameters of the inside of the text, Xcode does not mention? Auto-complete, But you can make it work. such as: _showbooklabel1.text = [NSString stringwithformat:@ "Author:%@ type:", _assigenmodel.author_name];author_name do not mention, but can be used. 19, in the use of local notification, if the notification is registered, but after the removal of the program, the installation of the time, there will be two notification reminders (because these notifications add to the system? noodles). The solution is to remove the previous notification when entering the program. 20, in the UITableViewCell in the dynamic exhibition of data, can be in the? Custom cell? A class? method to calculate the cell's height 21, in the use of the third party based on Flipsquaresnavigationcontroller Animation (push), in the process of animation will appear animation card phenomenon, the reason Is it a Flipsquaresnavigationcontroller animation? method, which is used in the next boundary. View property, this time will be the line viewdidload? method, if you create UI in Viewdidload? , will occupy? Using the main thread, according to the animation of the lag, solve? Method can be created in viewwillappear: or viewdidappear:? 22. The most significant difference between the deep copy and the shallow copy is whether the address of the copied member object is consistent, if the sub-object address is changed, it is the deep copy of the shell, and vice versa, it is the shallow cuff. 23, UITableView to a partition or a.

Nsindexpath *scrollindexpath = [Nsindexpath indexpathforrow:0 Insection:3];
[_tableview Scrolltorowatindexpath:scrollindexpath

Atscrollposition:uitableviewscrollpositiontop

ANIMATED:YES];24, school students in the video playback and download when the error occurred rtcreporting:resolve from Https://qtpartners.apple.com/storebags/hls? version=4.10, Solution plan (change the machine or change the Xcode can be)

。?? A similar error on the internet to solve the problem? The scheme is: 1, this seems tobe a problem with trying to play videos on the simulator. I ' Vehad This problem for months now, and just ran into it again

Today when I am trying to play video on my simulator.

The solution, while not great, are to use a actual device instead of Thesimulator for testing video playing.

2, you need use:[player play];

The IOS7 status bar adaptation issue after the "sound play" in the real device and in simulator.25 http://beyondvincent.com/blog/2013/11/03/120-

customize-navigation-status-bar-ios-7/

26, complete single case mode, need to rewrite retain, release, Autorelease, Retaincount and so on? methods. Related Introduction http://beyondvincent.com/blog/2013/05/09/20/, https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/cocoafundamentals/cocoaobjects/ Cocoaobjects.html

27. In the use of

28, from the other side of the cuff? project, only my Mac 64-bit optional, simulator can not be used, solve? Method:? First close your Xcode to find the item you have resolved this problem?? What's the target?? Directory, and then this entry?? Purpose ***.xcodeproj. File, then right-click on "Show Package Contents" such as:

!

? In general, the package has the following 3 files:

1.project.pbxproj 2.project.xcworkspace 3.xcuserdata

Find "Xcuserdata" the culprit? First, move it all to the trash, OK, reopen your item?? Accounts

The simulator that can be used by a normal display; (http://www.himigame.com/iphone-cocos2d/

621.html)

29. When declaring an instance variable, the NSString *_string is used, which is taken in the process of making use of the

An address, because this nsstring *_string; in the cavaluefunction conflict. If the name doesn't ask

It is possible that the object was released early, retain, perhaps.

30. Get the current project? Directory "$ (srcroot)"

31, SHARESDK Real machine appears undefined symbols for architecture arm64:

"_objc_class_$_weiboapi", referenced from:objc-class-ref in

MMAPPDELEGATE.O, solution? Method http://blog.csdn.net/topbar/article/details/

21449643<ios7.1 Compile error Resolution? Program Experience >

32. If the project is created, when the Self.view is found, the height is only 480, then the reason is the lack of 4

The launch map of English inch [email protected]

33, Baidu Map error [__nscfstring stringFromMD5]: Unrecognized selector sent to

Instance 0x1f836730

PROJECT->BUILD SETTING->OTHER linker flags

Write the-OBJC.

Baidu map often see error:

(1) Compile the normal, the operation of the newspaper [Uidevice Uniqueglobaldeviceidentifier]:

Unrecognized selector sent to this time the other linker flags are required to add the-all_load parameter.

Specific: Project->build settings->linking->other Linker flags (2) Compile the report Undefined symbols for architecture armv7. Please check that there are no additions to quartzcore.framework and corelocation.framework

(3) Bmkmapmanager is strongly recommended to be managed by a singleton mode and not manually adjusted with its release method.

(4) In-line? User Location positioning In addition to set showsuserlocation = YES, but also in the Mapview:didupdateuserlocation:? method to adjust the use of setcentercoordinate:animated

In addition, must be in the dealloc, or other to leave the page? The square of the side of the showsuserlocation= no, otherwise there will be two times push to the positioning? page, the problem will not be repositioned.

(5) must? At least let a class keep the. mm file, or modify the compiler type according to the official's side. (6) Lipo–create RELEASE-IPHONEOS/LIBBAIDUMAPAPI.A release-

Iphonesimulator/libbaidumapapi.a–output LIBBAIDUMAPAPI.A If the error, please change to

Lipo–create–output LIBBAIDUMAPAPI.A RELEASE-IPHONEOS/LIBBAIDUMAPAPI.A RELEASE-IPHONESIMULATOR/LIBBAIDUMAPAPI.A can be solved. 34. Remind students to learn how to work in the project? When you drag a file? Be sure to choose Copy and addtotargets.35, and the interactivity of some controls userinteractionenabled< this problem I feel I can not solve, As long as the pre-instructor has repeatedly emphasized the words >.
36, Note:after modifying system headers, please delete the Modulecache at '/users/sumomochuufuku/library/developer/xcode /deriveddata/modulecache/2nevap7x943d2 '. Workaround: Go to '/users/sumomochuufuku/library/developer/xcode/deriveddata/modulecache/2nevap7x943d2 this? folder, delete the contents of the folder, Then the mobile app, no problem, note is not deleted 2nevap7x943d2 folder,? But the content. And then clean the next item?? (product, Clean) <IOS7 Development Error Collection http://blog.csdn.net/smallsky_keke/article/details/16117653>

37, if you should use the program is from the other side of the cuff, if the third party open source framework to make the wrong or can not find, then the third party open source framework re-guide? Once in a while 38, the transport line Xcode on the real machine, or archive packaging, will eject the loss? Enter the user name and Password box: "Mac OS X" wants to enter the line changes. Enter the name and password of the administrator to allow this action ("Mac

OS X "Want to make use of the system keychain", solve? The method is as follows

1. First, in the general of the app Icons source--> AppIcon2. In the images.xcassets, add the corresponding ruler in turn. Select Icon.3, and under the third button on the right, tick the IOS icon Is pre-rendered.

4. Compiling, shipping, icon? The highlight effect is gone. PS: If, still exists, please uninstall the app first and then re-ship the line.

40, if the use of Mailcore2 third party open source framework, then need to be linked?? Web download East West, if?? If the network is not smooth, the error will be.
41. XCode 5 "iOS simulator failed to install this should?" Workaround: http://blog.csdn.net/somestill/article/details/1940204942, when using system JSON in iOS , it is found that the return data is in JSON format, but parsing it is a null, it is possible to return the data encoding format problem, you can try to use the ASI responsestring, and then convert the responsestring into NSData, in the. It is possible to parse the JSON with the system. 43, Baidu Map and SHARESDK? With the use of the time, the last error duplicate Symbol_isretina in, solve the plan to cancel the all_load. 44. If you are born with a third party static library such as SHARESDK error undefinedsymbols for architecture arm64: or x86-64, the current static library does not? Support 64

bit, you need to delete the arm64 under the valid architectures under Build settings, and change the build Active Architecture only to No.

45. If you take pictures with the real machine, save the picture to the local document file, and then remove the picture again? The slice rotates 90° can be used to solve the following method:

Cgimageref Oldimageref=image. Cgimage;

uiimage* newimage=[uiimage Imagewithcgimage:oldimageref Scale:.1orientation:uiimageorientationright];

Reference Link: http://www.2cto.com/kf/201404/290777.html46, if you want to set the status bar in iOS? White color, then need [[uiapplicationsharedapplication] Setstatusbarstyle:uistatusbarstylelightcontent]; Also change view controller-based status bar appearance to No in plist file?

47, when playing music, how to set up no problem, but no sound, this time need to consider whether the player is set to local variables. 48. If the Uitableviewcell,didselect method does not go, the other agents? Methods are gone, so is there? Gesture intercepted Uitabelviewcell's Didselect event 49, Xcode gets? The relative path of the project: $ ( Srcroot) 50, in the CoreData when the receiver type ' nsmanagedobjectcontext ' for the instance message is a forwarddeclaration and other 9 (indeterminate , or 7) error, because although the CoreData framework is not included in the. pch file? #import, reference link: http://blog.csdn.net/xiaoxuan415315/article/details /794086151, if the program at the time of the operation of the crash, the emergence of a reference to a class Setvalue:forundefinedkey:, and this key in the class? or the whole project, the surface can not be searched, then this time to consider making? When using storyboard,? A control pulls a two-wire case. 52, in the SHARESDK to use the QQ space to share the time, appear to mention could not buildmodule Uikit, the simulator replaced by the real machine debugging 53, at the same time to use Baidu Map SDK and Baidu Navigation SDK when the following 10 error resolution? The scenario is to add the other linker flags in build settings-OBJC

The error is as follows: Ld:warning:directory not found for option '-l/users/lanou3g/documents/daemonson/navigationgo/baidunavisdk/ Statistic '
Undefined Symbols for Architecture i386:

"_msr_close", referenced from:
Cvmfe::mfeclose () in libbaidunavisdk.a (VMFE.O)

"_msr_detect", referenced From:cvmfe::mfedetect () in libbaidunavisdk.a (VMFE.O)

"_msr_exit", referenced from:
Ld:symbol (s) not found for architecture i386
Clang:error:linker command failed with exit code 1 (use-v to Seeinvocation)
54. After each modification, Xcode compiles the Developer tools access, which requires control of another process to continue debugging, which can be resolved with the following Terminal command. Sudo/usr/sbin/devtoolssecurity-enable. Reference connection: http://blog.csdn.net/xyxjn/article/details/1611177354, upload the program when the missing screenshot ", probably because the project was created when the choice is mixed engineering, But no ipad 55, Youku m3u8 address format, 1, http://v.youku.com/player/getM3U8/vid/XNzI3NTI1NjUy/type/flv 2, http://pl.youku.com/ Playlist/m3u8?vid=xnziwmde5nzi4&type=mp4
Http://pl.youku.com/playlist/m3u8?

vid=162779600&ts=1407469897&ctype=12&token=3357&keyframe=1&sid=640746989782612d6cc70& ev=1&type=flv&ep=dcauhu2lx8yj4ivdjj8bmyqxj3apxp8m9bicinrianqns%2b24&oip=2043219268 56, do not update the UI in a child thread  , and if the child thread has an automatically freed object, you need to manually add the auto-free pool. 57, No architectures to compile for (archs=armv7 armv7s arm64, valid_archs=armv7s,armv7). When this error occurs, it is because VALID archit Ectures format is not the same as the format of architectures.  For example architectures is a space, Valid architectures Middle is "," (comma). 58. Core data:receiver type ' Nsmanagedobjectcontext ' for class is a forward declaration. Solution: A title error occurred while using core data, Coredata.framework was added to the project and finally found on StackOverflow, and #import <coredata/cor was originally added to Xxx.pch Edata.h>

59, the students grasp the pretext of the time network, grasping the interface can catch data, but in the request

When there is no data, it is because the header is missing,
The code is as follows: Nsurl *url = [Nsurl urlwithstring:@ "http://api.m.mtime.cn/Showtime/LocationMovies.api?locationId=290"];


Nsmutableurlrequest *request = [Nsmutableurlrequest requestwithurl:url cachepolicy: Nsurlrequestreloadignoringlocalcachedata Timeoutinterval:-1];
[Request sethttpmethod:@ "GET"];
[Request addvalue:@ "5,1406738416605,b99daada90f36e724ea7a12214774062" forhttpheaderfield:@ "  X-mtime-mobile-checkvalue "]; [Request setvalue:@ "text/html" forhttpheaderfield:@ "Content-type"];
[Nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue Mainqueue] completionHandler:^ (  Nsurlresponse *response, NSData *data, Nserror *connectionerror) {nsstring *string = [[NSString] Alloc] Initwithdata:data encoding:nsutf8stringencoding];

NSLog (@ "---str =%@", string);

}];
60, encountered the network interface return data garbled:?
can use
Nsstringencoding gbkencoding =cfstringconvertencodingtonsstringencoding (kcfstringencodinggb_18030_2000);  NSString *string = [[NSString alloc] InitWithData:self.data encoding:gbkencoding]; 61, encountered an error, ld:building for IOS Simulator, but linking against Dylib built for MacOSX file '/applications/xcode. app/contents/developer/

Library/frameworks/xctest.framework/xctest ' for Architecture x86_64

Clang:error:linker command failed with exit code 1 (use-v to see invocation) 1 Remove the xctest.framework from the lower face,

2 then put the test project. m file to the right of the target check off, retention test (such as).

62, IOS? Custom font http://blog.csdn.net/justinjing0612/article/details/8093985?63, if you can catch the data in the process of catching the port, but the code cannot request the data, So the possible reason is the lack of httpheader,? Example:

Nsmutableurlrequest *request = [nsmutableurlrequest  requestwithurl:[nsurl urlwithstring:@ "/http/ api.m.mtime.cn/  showtime/locationmovies.api?locationid=290 "]  CachePolicy: Nsurlrequestreloadignoringlocalcachedata  Timeoutinterval:-1];

[Request addvalue:@ "5,1406738416605,b99daada90f36e724ea7a12214774062" forhttpheaderfield:@ " X-mtime-mobile-checkvalue "]; Add Httpheader

    [Request sethttpmethod:@ "GET"];
    [nsurlconnection sendasynchronousrequest:request queue:  [Nsoperationqueue Mainqueue]  completionhandler:^ (Nsurlresponse *response, NSData *data,  nserror *connectionerror) {
        NSLog (@ "----request =%@", response);        NSLog (@ "= = = =%@", connectionerror);        NSLog (@ "data%@", data);        NSString *STR = [nsjsonserialization
  Jsonobjectwithdata:data  options:nsjsonreadingmutablecontainers Error:nil];
        NSString *string = [[NSString alloc]  initwithdata:data encoding:nsutf8stringencoding];
NSLog (@ "---str =%@", string);

}];

?

Forstate:uicontrolstatenormal]; Check the item font color: [[Uitabbaritem appearance]

settitletextattributes:@{nsforegroundcolorattributename: [Uicolor
Yellowcolor]}forstate:uicontrolstateselected];? 64, if in the process of making use of cocoapods, there is a case that the file cannot be found, then you need to enter the line configuration in the location of the next polygon.

63, Tabbaritem not selected title color: [[Uitabbaritem appearance]settitletextattributes:@{nsforegroundcolorattributename: [ Uicolor Whitecolor]}

65, compatible with iOS8 upgrade to Xcode6.0 before the compilation of the project, the results of the app can not be shipped on the real machine, the line. The error is as follows: The file "Xxxx.app" couldn ' t is openedbecause you don't have permission to view it.

Solution: View the project warning, find the need to update the old project settings: Click Upate to reconmmented settings, open the following window? Port:

66. This error occurs when you are in the process of shipping the program:

The reason for this error is because you have entered the "lo_viewconrller.m" file, or is it yours? The project has two lo_viewconrller. h and. m files.
67. iOS Objc_msgsend iOS too many arguments in function

Call Error resolution solution?

?

IOS Project Problem Summary

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.