Permalink
Browse files

Added iOS and Mac targets

Fixed compilation for both platforms.
  • Loading branch information...
1 parent 4e57cac commit 91406224f1291b3470d4d0afe64ae261b63edfc5 @isutton committed Dec 13, 2011
View
@@ -3,6 +3,8 @@ build/
*.mode1v3
*.pbxuser
*.perspectivev3
+*.xcodeproj/project.xcworkspace/*
+*.xcodeproj/xcuserdata/*
# OSX noise
.DS_Store
View
@@ -20,8 +20,6 @@
// THE SOFTWARE.
//
-#import <Cocoa/Cocoa.h>
-
/**
TumblrKit's additions to NSDictionary.
*/
View
@@ -20,7 +20,11 @@
// THE SOFTWARE.
//
-#import <Foundation/Foundation.h>
+#if TARGET_OS_IPHONE
+typedef UIImage TKImage;
+#elif TARGET_OS_MAC
+typedef NSImage TKImage;
+#endif
typedef enum
{
@@ -195,15 +199,15 @@ typedef enum
{
NSMutableString *caption;
NSString *source;
- NSImage *image;
+ TKImage *image;
NSUInteger width;
NSUInteger height;
}
@property (assign) NSUInteger width;
@property (assign) NSUInteger height;
@property (copy) NSString *source;
-@property (retain) NSImage *image;
+@property (retain) TKImage *image;
- (NSString *)caption;
- (void)setCaption:(NSString *)aCaption;
View
@@ -476,8 +476,12 @@ - (NSDictionary *)attributesAsDictionary
if (source != nil)
[dict setObject:source forKey:@"source"];
if (image != nil && source == nil) {
+#ifdef TARGET_OS_IPHONE
+ [dict setObject:UIImageJPEGRepresentation(image, 1.0) forKey:@"data"];
+#else
NSBitmapImageRep *bitmap = [[image representations] objectAtIndex:0];
[dict setObject:[bitmap representationUsingType:NSJPEGFileType properties:nil] forKey:@"data"];
+#endif
}
[dict setObject:caption forKey:@"caption"];
View
@@ -20,8 +20,6 @@
// THE SOFTWARE.
//
-#import <Cocoa/Cocoa.h>
-
typedef enum
{
TKTumblelogTypePublic,
View
@@ -126,7 +126,7 @@ - (BOOL)uploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain
if (delegate && [delegate respondsToSelector:@selector(tumblrDidFailToUploadPost:withDomain:returnCode:)]) {
[delegate tumblrDidFailToUploadPost:thePost
withDomain:theDomain
- returnCode:[theURLResponse statusCode]];
+ returnCode:(TKTumblrResponseReturnCode)[theURLResponse statusCode]];
}
return NO;
}
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.qiih.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2011 igorsutton.com. All rights reserved.</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'TumblrKit for Mac' target in the 'TumblrKit for Mac' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
@@ -0,0 +1,13 @@
+//
+// TumblrKit_for_Mac.h
+// TumblrKit for Mac
+//
+// Created by Igor Sutton on 12/13/11.
+// Copyright (c) 2011 igorsutton.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface TumblrKit_for_Mac : NSObject
+
+@end
@@ -0,0 +1,23 @@
+//
+// TumblrKit_for_Mac.m
+// TumblrKit for Mac
+//
+// Created by Igor Sutton on 12/13/11.
+// Copyright (c) 2011 igorsutton.com. All rights reserved.
+//
+
+#import "TumblrKit_for_Mac.h"
+
+@implementation TumblrKit_for_Mac
+
+- (id)init
+{
+ self = [super init];
+ if (self) {
+ // Initialization code here.
+ }
+
+ return self;
+}
+
+@end
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'TumblrKit for iOS' target in the 'TumblrKit for iOS' project
+//
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,13 @@
+//
+// TumblrKit_for_iOS.h
+// TumblrKit for iOS
+//
+// Created by Igor Sutton on 12/13/11.
+// Copyright (c) 2011 igorsutton.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface TumblrKit_for_iOS : NSObject
+
+@end
@@ -0,0 +1,23 @@
+//
+// TumblrKit_for_iOS.m
+// TumblrKit for iOS
+//
+// Created by Igor Sutton on 12/13/11.
+// Copyright (c) 2011 igorsutton.com. All rights reserved.
+//
+
+#import "TumblrKit_for_iOS.h"
+
+@implementation TumblrKit_for_iOS
+
+- (id)init
+{
+ self = [super init];
+ if (self) {
+ // Initialization code here.
+ }
+
+ return self;
+}
+
+@end
Oops, something went wrong.

0 comments on commit 9140622

Please sign in to comment.