小编Man*_*han的帖子

在ios上与Instagram上的图像共享文本

在我的应用程序中,我在Instagram上分享图像.它在我的应用程序中运行良好.

我使用以下代码.

@property (nonatomic, retain) UIDocumentInteractionController *dic;    

CGRect rect = CGRectMake(0 ,0 , 0, 0);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndImageContext();
NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.igo"];

NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", jpgPath]];
//    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];

self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
[self.dic presentOpenInMenuFromRect: rect    inView: self.view animated: YES ];


- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios instagram

8
推荐指数
1
解决办法
6321
查看次数

将文件夹从主包复制到iphone中的文档目录

我有一个应用程序,其中我的主包中有一个名为"Images"的文件夹.

在此文件夹中有另一个名为"Images1"的文件夹,其中包含一些图像.

当我的应用程序启动时,我想要文档目录中的文件夹"Images".

我想从文件夹"Images1"中获取图像.

但是我无法使用以下代码将文档放在文档目录的"Images"文件夹中.

编辑

       BOOL success1;
    NSFileManager *fileManager1 = [NSFileManager defaultManager];
    NSError *error1;
    NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory1 = [paths1 objectAtIndex:0];
   NSString *writableDBPath1 = [documentsDirectory1 stringByAppendingPathComponent:@"Images/Images1"];
    success1 = [fileManager fileExistsAtPath:writableDBPath1];

    if (success1) return;
    // The writable database does not exist, so copy the default to the appropriate location.
    NSString *defaultDBPath1 = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Images/Images1"];

    NSLog(@"Default : %@",defaultDBPath1);
    success1 = [fileManager1 copyItemAtPath:defaultDBPath1 toPath:writableDBPath1 error:&error1];

    if (!success1) {
        NSAssert1(0, @"Failed to create writable database file with …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios

5
推荐指数
1
解决办法
5762
查看次数

在cocoa mac OS X应用程序中分享facebook和twitter中的文本?

在此输入图像描述

嗨,我在目标c中有一个可可mac应用程序.

在我的应用程序中,我想在Facebook和Twitter上分享文本,就像我们在ios中使用SLComposeViewController一样.

我在谷歌搜索了很多,但找不到任何mac应用程序.

当我从Facebook分享它时,我看到上面的图像,而对于来自其中一个mac应用程序的twitter,我看到了相同的图像.

如何为我的mac应用程序实现相同的功能?

提前致谢...

macos xcode facebook objective-c ios

5
推荐指数
1
解决办法
523
查看次数

想要在iPhone通过UIActivityViewController成功发布帖子时执行某些操作

我正在使用我正在使用的应用程序UIActivityViewController.

这是我正在使用的代码.

 NSString *postText = @"My Text";
    NSArray *activityItems = @[postText];

    UIActivityViewController *activityController =
    [[UIActivityViewController alloc]
     initWithActivityItems:activityItems applicationActivities:nil];
    activityController.excludedActivityTypes = [NSArray arrayWithObjects:UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, nil];
    [self presentViewController:activityController
                       animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这很好用.当我打开Twitter或电子邮件时UIActivityViewController,它显示我想要分享的文本,这很好.

但是,现在我只想在帖子成功或电子邮件发送成功后才在我的数据库中执行某些操作.

我怎样才能做到这一点?

iphone xcode objective-c ios uiactivityviewcontroller

3
推荐指数
1
解决办法
2900
查看次数

如何动态获取InApp购买价格等级?

我有一个应用程序,我在其中使用5耗材应用程序购买.

按钮上有InApp Price.

-我不想静态设置In App的值(例如$ 0.99,$ 1.99等等......).

-我希望我的按钮上的价格动态实际上是在iTunes商店.

是否有可能从iTunes的InApp获得Price Tier并显示?

objective-c in-app-purchase ios

3
推荐指数
1
解决办法
1645
查看次数

在ios7中绘图时滞后

我有一个应用程序,我正在做一些关于视图的草图.

到目前为止,它一直工作正常,直到我安装ios7.

我的应用程序使用触摸移动的方法来识别运动的变化.但是当我绘制一条线时,触摸方法被调用但是直到我触摸结束才会更新线ios7.

所以绘画有一点滞后.

ios6ios7模拟器上和模拟器上工作正常但是当我在真实ios7设备上测试时,绘图算法存在滞后.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (!isImageSelection) {

            mouseSwiped = NO;
            UITouch *touch = [touches anyObject];

            if ( [touch view] != baseview) {

                lastPoint2 = [touch locationInView:self.viewDrawing2];
            }
        }
    }

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
 if (!isImageSelection) {

          //  NSLog(@"in image selection==%d touch moved   ",isImageSelection );

            mouseSwiped = YES;

            UITouch *touch = [touches anyObject];
            // if (([touch view] != btnInkColor) || ([touch view] …
Run Code Online (Sandbox Code Playgroud)

iphone drawing objective-c ios ios7

3
推荐指数
1
解决办法
1576
查看次数

如何在Objective-C中创建带有图像的自定义键盘扩展?

我有一个应用程序,我想在其中创建自己的自定义键盘.

在这个自定义键盘中,我想放置图像.

用户可以从设备的任何位置访问此键盘.

我希望它像这个链接.

我想制作这样的键盘 图片

我已经对此进行了大量搜索,我知道有很多教程,但大多数都是快速的,而另一些则没有键盘扩展.

我想要正确的指导或任何教程链接.

任何帮助将受到高度赞赏.

谢谢...

iphone keyboard objective-c ios

3
推荐指数
1
解决办法
5498
查看次数

如何在iOS中获取inapp中唯一购买的产品ID列表?

我有一个应用程序中有5个非消耗性应用程序购买。

在每一次In App购买中,我都会使用图像更新数据库。

有5种套餐可用于5种非消耗品的应用购买。

现在有还原购买功能,因为它不是应用程序内的消耗品。

我的应用程序中只有一个还原按钮。但是,如何识别已购买的产品呢?

我使用以下代码来恢复应用购买。但是它不会更新我的数据库,因为它不知道以前购买了哪些产品。

    if ([transaction.payment.productIdentifier isEqualToString:@"Pack1"])
    {
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedp1Once"])
        {
           // app already launched
           NSLog(@"Launching secondtime");
       }
       else
       {
           [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedp1Once"];
           NSLog(@"Launching first time");
           requestText= @"Animal";
           [self MakeQueryForUpdate];
           [self getdata];
       }
}


else if ([transaction.payment.productIdentifier isEqualToString:@"Pack2"])
{

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedp2Once"])
    {
        // app already launched
        NSLog(@"Launching secondtime");
    }
    else
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedp2Once"];
        NSLog(@"Launching first time");
        requestText= @"Celebrity";
        [self MakeQueryForUpdate];
        [self getdata];
    }

}

else if ([transaction.payment.productIdentifier isEqualToString:@"Pack3"])
{

    if …
Run Code Online (Sandbox Code Playgroud)

objective-c in-app-purchase ios

0
推荐指数
1
解决办法
1671
查看次数