IOS platform Project access to Sina Weibo SDK pit

Source: Internet
Author: User

Problems encountered

After the document Access project that came with the Sina Weibo SDK, the project runs on the real machine and crashes when the registration method is invoked. Registration Method Code:

1
[WeiboSDK registerApp: @"xxxxxxxx"];

The crash information is printed as follows:

1
[__NSDictionaryM weibosdk_WBSDKJSONString] : unrecognized selector sent to instance 0x170255780
Resolve problems encountered by the obstacles

There is a note in the documentation included with the Sina Weibo SDK:

After a static library is introduced into the project, you need to add the –OBJC compilation option at compile time to avoid a program crash due to incomplete class loading in the static library. Method: Program Target->buid settings->linking under other Linker Flags item added-OBJC

People who have encountered the same crash on the web have mentioned that adding compilation options at compile time -all_load can also solve the problem. The method is also added under Target->buid settings->linking other Linker Flags item -all_load . The same crash occurs when the compilation runs again.

Both the set- -ObjC up -all_load and compile-time failures will report link errors that cannot be found for the symbol above.

The right solution

Here's the right solution to talk about why. The correct approach is to set the other Linker Flags this compile option, -ObjC but is -all_load not used and can not be used, but to use -force_load path/to/your/libWeiboSDK.a , followed by the Sina Weibo SDK static link library of the exact location.

Why is all this?

It is said to have links, loads and libraries, so be prepared to read the "self-cultivation of programmers".

IOS platform Project access to Sina Weibo SDK pit

Related Article

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.