Basic knowledge of IOS development-fragmentation 42, basic knowledge of ios-42
1: thread 1: exc_bad_access (code = 1, address = 0x70 ********) is returned.
This error is usually caused by memory management. It is generally caused by access to released Objects. You can enable Zombie Objects to locate the problem:
In the Xcode menu:
Product-> Scheme-> Edit Scheme-> Run
Select Enable Zombie Objects in the options on the right to view detailed error information;
2: static library (SDK) knowledge point
1.1 static and dynamic databases: static databases :. a and. framework dynamic library :. dylib and. difference between framework1.2 static library and dynamic library static library: When linked, the static library will be completely copied to the executable file. When used multiple times, there will be multiple redundant copies of the dynamic library: the link is not copied. When the program is running, the system dynamically loads the data to the memory for calling. The system only loads the data once. Multiple programs are shared to save memory. Note: If a dynamic library is used in the project, will Apple reject version 1.3 of static library files (4 types) of real machine-Debug version of real machine-Release version Simulator-Debug version Simulator-Release version 1.3.1 Debug (debugging) Version 1. contains complete Symbol Information for debugging. the code is not optimized. 1.3.2 Release (Release) Version 1. does not contain complete symbolic information 2. the Execution Code of is optimized 3. the size is slightly smaller than that of the Debug version. 4. in terms of execution speed, the Release version will be faster (but it does not mean a significant improvement ). Package Release (released) version, which is provided to the outside world. Note that the package is generated in two modes and then merged. The CPU architecture of the device (supplemented knowledge) simulator: 4s ~ 5: i3865s ~ 6 plus: x86_64 real machine: 3gs ~ 4S: armv75 ~ 5c: armv7s (as long as the static library supports armv7, it can run on the armv7s architecture) 5s ~ 6 plus: arm64
A: Because dynamic. framework is not allowed to be installed on apple, you can only use the static method. When creating a static library, remember to select the target IOS version;
B: The resource file bundle is included after the framework is generated. You can manually remove the bundle and send it to the caller. Otherwise, the bundle cannot be introduced in the framework project and cannot be identified;
C: Check the currently supported CPU architecture. The address must be correct and then use lipo-info (the following is for the framework. If it is. a, you can directly view lipo-info xxxx.)
wjy-MacBook-Pro:Products wujunyang$ cd /Users/wujunyang/Library/Developer/Xcode/DerivedData/jiaCoreSDK-bgpoefwfpffqejccohhhngirohwn/Build/Products/Debug-iphoneos wjy-MacBook-Pro:Debug-iphoneos wujunyang$ lipo -info jiaCoreSDKLib.framework/jiaCoreSDKLibArchitectures in the fat file: jiaCoreSDKLib.framework/jiaCoreSDKLib are: armv7 arm64
Framework merge command
lipo -create Debug-iphoneos/jiaCoreSDK_Share.framework/jiaCoreSDK_Share Debug-iphonesimulator/jiaCoreSDK_Share.framework/jiaCoreSDK_Share -output jiaCoreSDK_Share
Note that the framework combines the files in the. framework, generates one, and replaces one with the. framework. This is the file we want;
For the merging of. a, see the following article;
D :. a and. different frameworks ,. a. Put all open header files in the called Project. the framework can open only one header file, but both public and header files are required;
E: when creating a Static Library, remember to set the Mach-O Type of Build Settings in tagerts to Static Library.
F: Pay attention to setting the lowest IOS version of. a or. framework technology. do not generate it on the real machine and simulator during generation and then merge it;
G: knowledge about how to create. a and. framework:
Address: http://www.jianshu.com/p/8f5b9855efb8?ios static Library Development]
Address: http://www.cnblogs.com/richard-youth/p/4856841.html#iosstatic database summary -- (yoowei )]
Address: http://www.jianshu.com/p/c305175bfab2?iosdevelopment project-static database]
Address: https://github.com/wujunyang/jiacoresdk?]
Address: https://www.sdk.cn/news/3342 [static library contains other static library SDK should pay attention to the problem]
3: iOS proxy (protocol and delegate)
Let's take a look at the code used by protocol and delegate and have a general understanding.
Assume there are two classes: personOne and personTwo,
PersonOne is the delegate and personTwo is the agent.
PesonOne. h
# Import <Foundation/Foundation. h> @ protocol SomeThing <NSObject> // event to be proxy-(void) doSomeThing :( NSString *) someThing; @ end @ interface PersonOne: NSObject // someone else needs to do this for himself/someone who wants to do this for himself must know the relevant Protocol; @ property (weak) id <SomeThing> delegate; // weak: you do not need to allocate space for this delegate. // Id: it can be an object. @ End
PersonTwo. h
# Import <Foundation/Foundation. h> # import "PersonOne. h "@ interface PersonTwo: NSObject <SomeThing> // Add <SomeThine> to indicate that the agent knows the relevant agreement and can take over the agent. @ End
PersonTwo. m
# Import "PersonTwo. h "@ implementation PersonTwo // The proxy starts to do the client's account (required)-(void) doSomeThing :( NSString *) someThing {NSLog (@ "% @............ ", someThing);} @ end
Real implementation of mutual correlation between the two parties
Main. m
# Import <Foundation/Foundation. h> # import "PersonTwo. h "# import" PersonOne. h "int main (intargc, const char * argv []) {@ autoreleasepool {// The Real association between the proxy and the entrusting party. PersonOne * pA = [[PersonOne alloc] init]; PersonTwo * pB = [[PersonTwo alloc] init]; // pB replaces pA to complete the event pA. delegate = pB; // pA. delegate determines whether pB exists. // use [pA. delegate respondsToSelector: @ selector (doSomeThing :)] determine whether pB has implemented the required method. If (pA. delegate & [pA. delegate respondsToSelector: @ selector (doSomeThing :)]) {// pA provides a parameter to pB (only parameters are provided, regardless of the specific usage) [pA. delegate doSomeThing: @ "hello world"] ;}} return 0 ;}
This entire proxy event is illustrated in an image metaphor:
A coffee shop has a very good business. The boss (personOne) decided to hire a barista to help. So I posted an announcement (delegate)
Announcement content: (protocol)
I have more than one year of experience in recruiting a barista. Priority will be given to those who will make the call.
From this announcement, we can know two points:
1-make coffee with more than one year of experience as a required condition (@ required: required)
2-it is optional to adjust the liquor. It is not a required condition (@ optional: optional implementation method (not all can be implemented ))
Therefore, all candidates must meet the first condition. The second condition is only a bonus item and is not indispensable.
After recruiting employee B, the boss asked B TO MAKE A Moka cup. As for how B does it, the boss does not care about it. He only cares about the result.
([PA. delegate doSomeThing: @ "hello world"];) --> [boss. delegate coffee: @ "Moka"];)
4: knowledge about iOS development using Cordova
IOS development with Cordova (Environment configuration and basic usage): http://www.jianshu.com/p/d24219c008b6
Use Cordova for iOS development (use of third-party plug-ins: Camera plug-ins): http://www.jianshu.com/p/1e3d0c915dbc
IOS development with Cordova (adding Cordova and custom plug-ins to saved projects): http://www.jianshu.com/p/e982b9a85ae8
Cordova plug-in development entry (IOS edition OC and JS interaction): http://my.oschina.net/crazymus/blog/516388
Analysis of Cordova for iOS (OC and JS interaction): http://www.cocoachina.com/industry/20130520/6238.html
Note: In a newer version, if the generated project does not change, the OC code and XML configuration will be updated as long as the import plug-in command is entered in the path, many steps can be omitted in the second article above;
Locating plug-ins:
Enter the directory and run the following command on the terminal ):
cordova plugin add cordova-plugin-geolocation
Modify the index.html code:
<! DOCTYPE html>