Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the information of how to install the sdk

  • Loading branch information...
commit bfe49273f1012f863f9e561e94820c318a9d0e20 1 parent 4ade338
@JimLiu authored
View
8 README.md
@@ -1,13 +1,13 @@
# WeiboSDK #
新浪微博SDK,基于v2版API接口,对认证和请求进行了封装,
-## sample ##
+## 静态库引用SDK实例 ##
SDK应用示例(静态库引用),包含最新微博列表、多帐号管理、发布文字微博、发布图片微博等功能示例。
-详情请见:[sample](https://github.com/JimLiu/WeiboSDK/tree/master/sample "新浪微博SDK示例") 。
+静态库引用SDK的安装方式请见:[sample](https://github.com/JimLiu/WeiboSDK/tree/master/sample "新浪微博SDK示例") 。
-## sample_nolib ##
+## 非静态库引用SDK实例 ##
SDK应用示例(非静态库引用,代码引用),包含最新微博列表、多帐号管理、发布文字微博、发布图片微博等功能示例。
-详情请见:[sample_nolib](https://github.com/JimLiu/WeiboSDK/tree/master/sample_nolib "新浪微博SDK示例") 。
+非静态库安装方式请见:[sample_nolib](https://github.com/JimLiu/WeiboSDK/tree/master/sample_nolib "新浪微博SDK示例") 。
##API参考文档##
View
16 sample/README.md
@@ -1,5 +1,17 @@
-# sample #
+# 静态库引用SDK实例 #
SDK应用示例(静态库引用),包含最新微博列表、多帐号管理、发布文字微博、发布图片微博等功能示例。
##安装说明##
-TODO...
+1. 在目标项目中添加WeiboSDK项目
+2. Target Dependencies里面添加WeiboSDK静态库
+3. Link Binary With Libraries中添加以下框架或静态库:
+ *CFNetwork.framework
+ *SystemConfiguration.framework
+ *MobileCoreServices.framework
+ *CoreGraphics.framework
+ *libz.dylib
+ *libWeiboSDK.a
+4. 在Build Settings的Other Linker Flags中添加:-all_load
+
+##使用说明##
+请参考示例
View
85 sample_nolib/README.md
@@ -1,5 +1,84 @@
-# sample_nolib #
-SDK应用示例(非静态库引用,代码引用),包含最新微博列表、多帐号管理、发布文字微博、发布图片微博等功能示例。
+# 非静态库引用SDK实例 #
+SDK应用示例,SDK功能直接引用代码,避免静态库引用导致的重复引用等问题,该演示包含最新微博列表、多帐号管理、发布文字微博、发布图片微博等功能示例。
##安装说明##
-TODO...
+1. 在项目中添加WeiboSDK相关代码,清单如下:
+
+>-src
+> --Additions
+> ---NSDictionaryAdditions.h
+> ---NSDictionaryAdditions.m
+> --Models
+> ---GeoInfo.h
+> ---GeoInfo.m
+> ---Province.h
+> ---Province.m
+> ---Resources.h
+> ---Resources.m
+> ---Status.h
+> ---Status.m
+> ---User.h
+> ---User.m
+> --Utilities
+> ---PathHelper.h
+> ---PathHelper.h
+> --WeiboEngine
+> ---WeiboQuery
+> ----StatusQuery.h
+> ----StatusQuery.m
+> ----TimelineQuery.h
+> ----TimelineQuery.m
+> ----UserQuery.h
+> ----UserQuery.m
+> ----WeiboQuery.h
+> ----WeiboQuery.m
+> ---WeiboAccount.h
+> ---WeiboAccount.m
+> ---WeiboAccounts.h
+> ---WeiboAccounts.m
+> ---WeiboAuthentication.h
+> ---WeiboAuthentication.m
+> ---WeiboConfig.h
+> ---WeiboEngine.h
+> ---WeiboRequest.h
+> ---WeiboRequest.m
+> ---WeiboSignIn.h
+> ---WeiboSignIn.m
+> ---WeiboSignInViewController.h
+> ---WeiboSignInViewController.m
+> ---WeiboSignInViewController.xib
+
+2. 安装第三方类库ASIHTTPRequest、JsonKit和MBProgressHUD,具体请参考其官方说明。
+[首页](https://github.com/JimLiu/WeiboSDK/ "首页")有它们的链接地址。
+
+
+##使用说明##
+请参考示例
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
View
3  src/Models/GeoInfo.h
@@ -7,8 +7,9 @@
//
#import <Foundation/Foundation.h>
+#import "NSDictionaryAdditions.h"
-@interface GeoInfo : NSObject {
+@interface GeoInfo : NSObject<NSCoding> {
double _latitude; //纬度
double _longitude; //经度
}
View
21 src/Models/GeoInfo.m
@@ -7,7 +7,6 @@
//
#import "GeoInfo.h"
-#import "NSDictionaryAdditions.h"
@implementation GeoInfo
@synthesize latitude = _latitude;
@@ -26,4 +25,24 @@ - (id)initWithJsonDictionary:(NSDictionary*)dic
return self;
}
+//===========================================================
+// Keyed Archiving
+//
+//===========================================================
+- (void)encodeWithCoder:(NSCoder *)encoder
+{
+ [encoder encodeDouble:self.latitude forKey:@"latitude"];
+ [encoder encodeDouble:self.longitude forKey:@"longitude"];
+}
+
+- (id)initWithCoder:(NSCoder *)decoder
+{
+ self = [super init];
+ if (self) {
+ self.latitude = [decoder decodeDoubleForKey:@"latitude"];
+ self.longitude = [decoder decodeDoubleForKey:@"longitude"];
+ }
+ return self;
+}
+
@end
View
2  src/Models/Province.h
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
-@interface Province : NSObject {
+@interface Province : NSObject<NSCoding> {
NSString *_name;
NSString *_provinceId;
NSMutableDictionary *_cities;
View
21 src/Models/Province.m
@@ -30,6 +30,27 @@ - (id)initWithDictionary:(NSDictionary *)dict {
return self;
}
+//===========================================================
+// Keyed Archiving
+//
+//===========================================================
+- (void)encodeWithCoder:(NSCoder *)encoder
+{
+ [encoder encodeObject:self.name forKey:@"name"];
+ [encoder encodeObject:self.provinceId forKey:@"provinceId"];
+ [encoder encodeObject:self.cities forKey:@"cities"];
+}
+
+- (id)initWithCoder:(NSCoder *)decoder
+{
+ self = [super init];
+ if (self) {
+ self.name = [decoder decodeObjectForKey:@"name"];
+ self.provinceId = [decoder decodeObjectForKey:@"provinceId"];
+ self.cities = [decoder decodeObjectForKey:@"cities"];
+ }
+ return self;
+}
//===========================================================
// dealloc
View
1  src/Models/Resources.h
@@ -7,6 +7,7 @@
//
#import <Foundation/Foundation.h>
+#import "SBJson.h"
#import "Province.h"
@interface Resources : NSObject
View
5 src/Models/Resources.m
@@ -7,7 +7,6 @@
//
#import "Resources.h"
-#import "JSONKit.h"
static NSMutableDictionary *gProvinces;
@@ -21,8 +20,8 @@ + (NSString *)provincesJson {
+ (NSMutableDictionary *)provinces {
if (!gProvinces) {
gProvinces = [[NSMutableDictionary alloc] init];
-
- NSDictionary *dic = [[Resources provincesJson] objectFromJSONString];
+
+ NSDictionary *dic = [[Resources provincesJson] JSONValue];
if (dic) {
NSArray *provinces = [dic objectForKey:@"provinces"];
if (provinces) {
View
6 src/Models/Status.h
@@ -7,10 +7,11 @@
//
#import <Foundation/Foundation.h>
+#import "NSDictionaryAdditions.h"
#import "GeoInfo.h"
#import "User.h"
-@interface Status : NSObject {
+@interface Status : NSObject<NSCoding> {
NSString *_statusIdString; //字符串型的微博ID
time_t _createdAt; //创建时间
long long _statusId; //微博ID
@@ -30,6 +31,8 @@
GeoInfo *_geo; //地理信息字段
User *_user; //微博作者的用户信息字段
Status *_retweetedStatus; // 转发微博
+
+ NSNumber *_statusKey;
}
+ (Status *)statusWithJsonDictionary:(NSDictionary*)dic;
@@ -54,5 +57,6 @@
@property (nonatomic, retain) GeoInfo *geo;
@property (nonatomic, retain) User *user;
@property (nonatomic, retain) Status *retweetedStatus;
+@property (nonatomic, readonly) NSNumber *statusKey;
@end
View
17 src/Models/Status.m
@@ -7,7 +7,6 @@
//
#import "Status.h"
-#import "NSDictionaryAdditions.h"
@implementation Status
@synthesize statusIdString = _statusIdString;
@@ -40,15 +39,15 @@ - (id)initWithJsonDictionary:(NSDictionary*)dic
if (self) {
self.statusIdString = [dic stringValueForKey:@"idstr"];
self.createdAt = [dic timeValueForKey:@"created_at"];
- self.statusId = [dic longLongValueForKey:@"id"];
+ self.statusId = [dic longLongValueValueForKey:@"id"];
self.text = [dic stringValueForKey:@"text"];
self.source = [dic stringValueForKey:@"source"];
self.favorited = [dic boolValueForKey:@"favorited"];
self.truncated = [dic boolValueForKey:@"truncated"];
- self.inReplyToStatusId = [dic longLongValueForKey:@"in_reply_to_status_id"];
- self.inReplyToUserId = [dic longLongValueForKey:@"in_reply_to_user_id"];
+ self.inReplyToStatusId = [dic longLongValueValueForKey:@"in_reply_to_status_id"];
+ self.inReplyToUserId = [dic longLongValueValueForKey:@"in_reply_to_user_id"];
self.inReplyToScreenName = [dic stringValueForKey:@"in_reply_to_screen_name"];
- self.mid = [dic longLongValueForKey:@"mid"];
+ self.mid = [dic longLongValueValueForKey:@"mid"];
self.middleImageUrl = [dic stringValueForKey:@"bmiddle_pic"];
self.originalImageUrl = [dic stringValueForKey:@"original_pic"];
self.thumbnailImageUrl = [dic stringValueForKey:@"thumbnail_pic"];
@@ -150,10 +149,16 @@ - (void)dealloc
[_geo release];
[_user release];
[_retweetedStatus release];
+ [_statusKey release];
[super dealloc];
}
-
+- (NSNumber *)statusKey {
+ if (_statusKey) {
+ _statusKey = [[NSNumber numberWithLongLong:_statusId]retain];
+ }
+ return _statusKey;
+}
@end
View
3  src/Models/User.h
@@ -7,6 +7,7 @@
//
#import <Foundation/Foundation.h>
+#import "NSDictionaryAdditions.h"
typedef enum {
GenderUnknow = 0,
@@ -19,7 +20,7 @@ typedef enum {
OnlineStatusOnline = 1,
} OnlineStatus;
-@interface User : NSObject {
+@interface User : NSObject<NSCoding> {
long long _userId; //用户UID
NSString* _screenName; //微博昵称
NSString* _name; //友好显示名称,如Bill Gates(此特性暂不支持)
View
3  src/Models/User.m
@@ -8,7 +8,6 @@
#import "User.h"
#import "Resources.h"
-#import "NSDictionaryAdditions.h"
@implementation User
@synthesize userId = _userId;
@@ -112,7 +111,7 @@ - (id)initWithJsonDictionary:(NSDictionary*)dic
{
self = [super init];
if (self) {
- self.userId = [dic longLongValueForKey:@"id"];
+ self.userId = [dic longLongValueValueForKey:@"id"];
self.screenName = [dic stringValueForKey:@"screen_name"];
self.name = [dic stringValueForKey:@"name"];
NSString *provinceId = [dic stringValueForKey:@"province"];
View
2  src/WeiboEngine/WeiboSignIn.m
@@ -44,7 +44,7 @@ - (void)signInOnViewController:(UIViewController *)viewController {
signInWeiboController.authentication = self.authentication;
UINavigationController *navController = [[[UINavigationController alloc]initWithRootViewController:signInWeiboController] autorelease];
[signInWeiboController release];
- [viewController presentModalViewController:navController animated:YES];
+ [viewController presentViewController:navController animated:YES completion:NULL];
}
View
3  src/WeiboEngine/WeiboSignInViewController.h
@@ -8,10 +8,11 @@
#import <UIKit/UIKit.h>
#import "WeiboAuthentication.h"
+#import "MBProgressHUD.h"
@class MBProgressHUD;
-@interface WeiboSignInViewController : UIViewController<UIWebViewDelegate> {
+@interface WeiboSignInViewController : UIViewController<UIWebViewDelegate, MBProgressHUDDelegate> {
UIWebView *_webView;
UIBarButtonItem *_cancelButton;
UIBarButtonItem *_stopButton;
View
2  src/WeiboEngine/WeiboSignInViewController.m
@@ -41,7 +41,7 @@ - (void)dealloc {
- (void)cancel:(id)sender {
[HUD hide:YES];
_closed = YES;
- [self dismissModalViewControllerAnimated:YES];
+ [self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)stop:(id)sender {
View
4 src/WeiboSDK.xcodeproj/project.pbxproj
@@ -71,6 +71,8 @@
B55992B81608E6A00037448E /* WeiboSDK-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = B559916B1608DB8E0037448E /* WeiboSDK-Prefix.pch */; };
B55992D11608E92F0037448E /* ASIAuthenticationDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = B55992CF1608E92F0037448E /* ASIAuthenticationDialog.h */; };
B55992D21608E92F0037448E /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = B55992D01608E92F0037448E /* ASIAuthenticationDialog.m */; };
+ B5B7FEA4160A364000A085C4 /* MBProgressHUD.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B559921B1608DC0D0037448E /* MBProgressHUD.h */; };
+ B5B7FEA5160A36D300A085C4 /* NSDictionaryAdditions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B559917D1608DBD50037448E /* NSDictionaryAdditions.h */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -80,6 +82,8 @@
dstPath = "include/${PRODUCT_NAME}";
dstSubfolderSpec = 16;
files = (
+ B5B7FEA5160A36D300A085C4 /* NSDictionaryAdditions.h in CopyFiles */,
+ B5B7FEA4160A364000A085C4 /* MBProgressHUD.h in CopyFiles */,
B55992451608DDA20037448E /* GeoInfo.h in CopyFiles */,
B55992461608DDA20037448E /* Province.h in CopyFiles */,
B55992471608DDA20037448E /* Resources.h in CopyFiles */,
View
10 thirdparts/ASIHTTPRequest/ASIAuthenticationDialog.m
@@ -217,9 +217,9 @@ - (UITextField *)domainField
+ (void)dismiss
{
if ([sharedDialog respondsToSelector:@selector(presentingViewController)])
- [[sharedDialog presentingViewController] dismissModalViewControllerAnimated:YES];
+ [[sharedDialog presentingViewController] dismissViewControllerAnimated:YES completion:NULL];
else
- [[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
+ [[sharedDialog parentViewController] dismissViewControllerAnimated:YES completion:NULL];
}
- (void)viewDidDisappear:(BOOL)animated
@@ -237,9 +237,9 @@ - (void)dismiss
[[self class] dismiss];
} else {
if ([self respondsToSelector:@selector(presentingViewController)])
- [[self presentingViewController] dismissModalViewControllerAnimated:YES];
+ [[self presentingViewController] dismissViewControllerAnimated:YES completion:NULL];
else
- [[self parentViewController] dismissModalViewControllerAnimated:YES];
+ [[self parentViewController] dismissViewControllerAnimated:YES completion:NULL];
}
}
@@ -315,7 +315,7 @@ - (void)show
}
#endif
- [[self presentingController] presentModalViewController:self animated:YES];
+ [[self presentingController] presentViewController:self animated:YES completion:NULL];
}
#pragma mark button callbacks
View
4 thirdparts/MBProgressHUD/MBProgressHUD.m
@@ -372,7 +372,7 @@ - (void)cleanUp {
- (void)setupLabels {
label = [[UILabel alloc] initWithFrame:self.bounds];
label.adjustsFontSizeToFitWidth = NO;
- label.textAlignment = UITextAlignmentCenter;
+ label.textAlignment = NSTextAlignmentCenter;
label.opaque = NO;
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor whiteColor];
@@ -383,7 +383,7 @@ - (void)setupLabels {
detailsLabel = [[UILabel alloc] initWithFrame:self.bounds];
detailsLabel.font = self.detailsLabelFont;
detailsLabel.adjustsFontSizeToFitWidth = NO;
- detailsLabel.textAlignment = UITextAlignmentCenter;
+ detailsLabel.textAlignment = NSTextAlignmentCenter;
detailsLabel.opaque = NO;
detailsLabel.backgroundColor = [UIColor clearColor];
detailsLabel.textColor = [UIColor whiteColor];
Please sign in to comment.
Something went wrong with that request. Please try again.