我有一组由www.sudzc.com创建的类(用于iPhone/Flex/Javascript的非常棒的WDSL Web服务代理创建工具).
当我运行CMD + SHIFT + A来检查内存泄漏时,我收到以下消息:
具有+0保留计数的对象返回给调用者,其中预期+1(拥有)保留计数
以下是返回该消息的方法:
// Static method for initializing from a node.
+ (id) newWithNode: (CXMLNode*) node
{
return (id)[[[SoapObject alloc] initWithNode: node] autorelease];
}
Run Code Online (Sandbox Code Playgroud)
我不想用这个代码发送消息,它需要在项目中多次重新生成,因为Web服务发生了变化,我需要更新代理类.
有任何想法吗?
提前致谢.
贾森
我在将照片库中的图像附加到电子邮件时遇到了一些麻烦.
基本上,我的应用程序的一个功能允许用户拍照.当他们拍摄镜头时,我将URL参考记录到Core Data中的图像.我知道你必须通过去看ALAssetRepresentation图像.我已经在我的应用程序中运行并在用户想要查看他们已经拍摄的图像时运行.
我现在正试图允许用户将为活动拍摄的所有照片附加到电子邮件中.在执行此操作时,我遍历存储URL引用的Core Data实体,调用UIImage从中返回a的方法,ALAssetsLibrary然后使用NSData/ UIImageJPEGRepresentation和MFMailComposeViewController/ addAttachmentData方法将其附加.
问题是:当电子邮件呈现给用户时,表示图像的小蓝色方块没有附加图像.
这是代码:
- (void)sendReportReport
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"Log: Report"];
NSArray *toRecipients = [NSArray arrayWithObjects:@"someone@someco.com", nil];
[mailer setToRecipients:toRecipients];
NSError *error;
NSFetchRequest *fetchPhotos = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Photo" inManagedObjectContext:__managedObjectContext];
[fetchPhotos setEntity:entity];
NSArray *fetchedPhotos = [__managedObjectContext executeFetchRequest:fetchPhotos error:&error];
int counter;
for (NSManagedObject *managedObject in fetchedPhotos ) {
Photo …Run Code Online (Sandbox Code Playgroud)