iOS Development experience Summary One

Source: Internet
Author: User

1, using%zd printing Nsinteger,%tu printing Nsuinteger

2, Uiscrollview in iOS7 use AutoLayout cause cannot scroll, method is to add ScrollView content height

3, Uicollectionview data is not enough, can not slide, solution: TableView data regardless of how much, its interface by default can be sliding, Compared with TableView, CollectionView's data is less than one screen is that it cannot slide collectionview.alwaysbouncevertical=yes; The settings always slide vertically on the line.

4, direct ios7 of continuous jump

-(void) back

{

[Self Dismissviewcontrolleranimated:yes completion:^{

if ([Weakself.navigationcontroller Popviewcontrolleranimated:yes]) {

}

}];
}

5, iOS8 after the use of Wkwebview instead of Uiwebview,ios8 before using UIWebView for HTML display, using UIWebView memory consumption is too large does not release the problem. Wkwebview Resolve Memory usage issues

6, Enterprise certificate download version can be opened directly in the app, in the app has H5 page, you can directly click to download other applications

7, url transcoding problem,

The STRINGBYADDINGPERCENTESCAPESUSINGENCODING,IOS9 version requires the use of

Stringbyaddingpercentencodingwithallowedcharacters replaces before stringbyaddingpercentescapesusingencoding.

8. IOS Development, mixed use of Arc and non-arc in engineering

In the Xcode project we can use both arc and non-arc blending modes.

If your project uses a non-arc mode, add the-FOBJC-ARC tag to the ARC mode code file.

If your project is using ARC mode, add the-FNO-OBJC-ARC tag to the non-ARC mode code file.

ways to add Tags: Open: Your target, Build phases, Compile Sources 2, double-click the corresponding *.M file 3, in the pop-up window, enter the label mentioned above-fobjc-arc/-fno-objc-arc 4, Click Done to save

9.

Pay attention to size when sharing

The size of text must be greater than 0 less than 10k

Image must be less than 64k

URL must be greater than 0k

10, APNs push

Generation of a push PEM file:

The PEM certificate is the file that the server needs when it pushes to the Apple server.

    • Open Keychain Access and find the push certificate in certificates.

    • Export certificate and private key respectively to the. p12 file. For example:

Apple Development Push Services > Export Apple Development Push services ID123, saved as APNS-DEV-CERT.P12. Do the same for "Private Key" and save it as a apns-dev-key.p12 file.

? These files need to be converted to PEM format via terminal commands:
OpenSSL pkcs12-clcerts-nokeys-out APNS-DEV-CERT.PEM-INAPNS-DEV-CERT.P12
OpenSSL pkcs12-nocerts-out APNS-DEV-KEY.PEM-INAPNS-DEV-KEY.P12
A password is required here, enter 123456.

    • Remove password (123456 above)
      OpenSSL rsa-in apns-dev-key.pem-out Apns-dev-key.pem

    • Finally, you need to synthesize the keys and license files into a APNS-DEV.PEM file, which you need to use when connecting to APNs:
      Cat Apns-dev-cert.pem Apns-dev-key.pem > Apns-dev.pem

      The same distribution Certificate PEM file is generated in the same way.
      OpenSSL pkcs12-clcerts-nokeys-out APNS-DIS-CERT.PEM-INAPNS-DIS-CERT.P12
      OpenSSL pkcs12-nocerts-out apns-dis-key.pem-in apns-dis-key.p12openssl rsa-in apns-dis-key.pem-out Apns-dis-key.pem
      Cat Apns-dis-cert.pem Apns-dis-key.pem > Apns-dis.pem

IOS8 new system requires the use of new code

if ([[[Uidevice Currentdevice] systemversion] floatvalue] >= 8.0)

{

[[UIApplication Sharedapplication] Registerusernotificationsettings:[uiusernotificationsettings

Settingsfortypes: (Uiusernotificationtypesound | Uiusernotificationtypealert | Uiusernotificationtypebadge)

Categories:nil]];

[[UIApplication sharedapplication] registerforremotenotifications];

}

Else

{

This is still the original code.

[[UIApplication sharedapplication] Registerforremotenotificationtypes:

(Uiusernotificationtypebadge | Uiusernotificationtypesound | Uiusernotificationtypealert)];

}

The method used to determine whether push is open in IOS7 is:

Uiremotenotificationtype types = [[UIApplication sharedapplication] enabledremotenotificationtypes];

Return (types & Uiremotenotificationtypealert);

If this code is used in iOS, although there will be no crash phenomenon, but basically no effect.

In IOS8, we use the following new code to replace the above code

{

Uiremotenotificationtype types;

if ([[[Uidevice Currentdevice] systemversion] floatvalue] >= 8.0)

{

types = [[UIApplication sharedapplication] currentusernotificationsettings].types;

}

Else

{

types = [[UIApplication sharedapplication] enabledremotenotificationtypes];

}

Return (types & Uiremotenotificationtypealert);

}

iOS Development experience Summary One

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.