小编Hru*_*tai的帖子

在xcode 4.2中找不到'libxml/xmlversion.h'文件?

我正在我的应用程序中集成twitter应用程序,xcode 4.2当我从这段代码实现twitter的代码时,我的应用程序是使用ARC 创建的. 当我下载项目并运行它时,它工作得很好.当我在我的xcode 4.2基础应用程序中集成这个Twitter sdk代码时,它给了我错误,'libxml/xmlreader.h' file not found我已经解决了它只是以这种方式更改头文件#include <libxml2/libxml/xmlreader.h>但是在更改之前的错误已经解决但是我得到了新的错误'libxml/xmlversion.h' file not found.我试图更改文件的标题,xmlreader.h但此文件不可编辑我也更改了此文件的权限.但它不起作用.以这样的格式,#include <libxml2/libxml/xmlreader.h>但它不起作用.

请告诉我如何解决这个错误.

我已经在堆栈溢出中看到了一些问题

但它们在xcode 4.2中对我不起作用.请指导我.

iphone xsd xcode4.2

24
推荐指数
3
解决办法
2万
查看次数

如何在iPhone sdk中的MFMailComposer中创建和附加CSV文件?

我已经创建了一个csv文件,我也将它附加到MFMailComposer,它显示我的邮件编写器,但当我发送给用户的电子邮件时,它没有显示我在电子邮件中附加csv文件.我已经使用此代码创建csv文件并在其中添加数据.

        NSMutableString *mainString=[[NSMutableString alloc]initWithString:@""];
        //NSMutableArray *section = [[NSMutableArray alloc] init];
        for(int i = 0;i<[NameArray count];i++)
        {
            NSString *string=[indexArray objectAtIndex:i];
            string=[string stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""];
            [mainString appendFormat:@"\"%@\"",string];


            string=[NameArray objectAtIndex:i];  
            string=[string stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""];
            [mainString appendFormat:@",\"%@\"",string];

            string=[typearray objectAtIndex:i];
            string=[string stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""];
            [mainString appendFormat:@",\"%@\"",string];

            [mainString appendFormat:@",\"%@\"",string];
            [mainString appendFormat:@"\n"];

        }

        NSLog(@"getdatafor csv:%@",mainString);

        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,  NSUserDomainMask, YES);
        NSString *documentsDirectoryPath = [paths objectAtIndex:0];
        NSString *filePath = [documentsDirectoryPath  stringByAppendingPathComponent:@"history.csv"];
//        filePath = [filePath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSData* settingsData;
        settingsData = [mainString dataUsingEncoding: NSASCIIStringEncoding];

        NSError *error;
        [settingsData writeToFile:filePath atomically:YES];
//            NSLog(@"writeok"); …
Run Code Online (Sandbox Code Playgroud)

csv iphone mfmailcomposeviewcontroller

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

如何在iphone sdk的模拟器中获取用户当前位置?

我从这个方法获取用户位置

/*Region and Zoom*/
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.2;
span.longitudeDelta=0.2;

CLLocation *location1 = [locationManager location];

CLLocationCoordinate2D location = [location1 coordinate];

location.latitude = location.latitude;
location.longitude = location.longitude;
region.span=span;
region.center = location;

/*Geocoder Stuff*/

MKReverseGeocoder *geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:location];
geoCoder.delegate = self;
[geoCoder start];
mapView.showsUserLocation = TRUE;

[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
Run Code Online (Sandbox Code Playgroud)

这很好用,但是当我尝试在模拟器中运行此代码时,它会在此处崩溃,[mapView setRegion:region animated:TRUE];告知它不会获得纬度和经度值.那么如何让这个代码在模拟器中完美运行呢.

我必须让这个代码在模拟器中运行,这可能吗?

iphone mkmapview

4
推荐指数
2
解决办法
1万
查看次数

如何在iPhone SDK中将瘦图像更改为胖图像?

嗨,有没有办法在iPhone SDK中将图像瘦身尺寸改为脂肪尺寸,反之亦然?有点像这个图像

在这个应用程序中,我想让用户通过滑动他可以在iPhone SDK中测量其大小的滑块,将其图像从常规大小更改为胖大小?我认为这可以通过获取图像像素我已经尝试过此代码来获取图像像素,但它只是从图像中删除颜色.

UIImage *image      = [UIImage imageNamed:@"foo.png"];

CGImageRef imageRef = image.CGImage;
NSData *data        = (NSData *)CGDataProviderCopyData(CGImageGetDataProvider(imageRef));
char *pixels        = (char *)[data bytes];

// this is where you manipulate the individual pixels
// assumes a 4 byte pixel consisting of rgb and alpha
// for PNGs without transparency use i+=3 and remove int a
for(int i = 0; i < [data length]; i += 4)
{
    int r = i;
    int g = i+1;
    int b = i+2;
    int …
Run Code Online (Sandbox Code Playgroud)

iphone image-processing

4
推荐指数
1
解决办法
4302
查看次数

objective c - 如何将nsdata转换为字节数组

我正在使用UIImage转换为NSData.我希望将NsData转换为Byte Array,并在json Parser的帮助下将该Byte数组发布到服务器.

如果我将以下类型的静态字符串传递给服务器,则接受并存储.以下是示例字符串语法.我想要以下类型的字节数组将数据发布到服务器.

[255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,255,219,0,67,0,8,6,6,7,6 ,5,8,7,7,7,9,9,8,10,12,...]

对于上述结果,我将图像转换为数据如下:

UIImage *image = [UIImage imageNamed:@"image.png"];
NSData *data = UIImagePNGRepresentation(image);
Run Code Online (Sandbox Code Playgroud)

现在我想将NSdata转换为字节数组,因为我正在使用以下代码:

NSUInteger len = [data length];
Byte *byteData = (Byte*)malloc(len);
memcpy(byteData, [data bytes], len);
free(byteData)
Run Code Online (Sandbox Code Playgroud)

我也将它存储到NSdata.但不能得到结果.我也用循环键入代码,但每次它给出一个PNG作为结果.

我在上面的代码中做错了吗?

请给我一些帮助,并要求为此提供任何帮助.

提前致谢.

iphone bytearray objective-c

4
推荐指数
1
解决办法
1万
查看次数