小编yoz*_*hik的帖子

在deleteRowsAtIndexPaths上崩溃

当我从表中删除行时,我的应用程序崩溃了.以下是检测到错误和堆栈跟踪的源代码.感谢名单!

//delete row from database
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"\ncommitEditingStyle");

    //delete user from Users table with specified ID
    if(editingStyle == UITableViewCellEditingStyleDelete) 
    {

        //Get the object to delete from the array.
        [dbManager open: @DB_FILE_NAME];    

        //get userID from array usersIDList[row] = userID!
        NSNumber *usersID = [usersIDList objectAtIndex: [indexPath row]];
        [dbManager deleteUserWithID: [usersID intValue] table: @TABLE_USERS fieldName: @"UserID" ];

        [dbManager close];

        //Delete the object from the table.
        [self.tableView deleteRowsAtIndexPaths:
         [NSArray arrayWithObject: indexPath] 
        withRowAnimation: UITableViewRowAnimationFade];
    }
}

- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview delete-row

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

错误域= SKErrorDomain代码= 0"无法完成操作.(SKErrorDomain错误0.)"

我正在使用In App Purchase.我正试图从AppleStore获取所有交易.请求后,我收到一个错误代码:

请求错误错误Domain = SKErrorDomain Code = 0"无法完成操作.(SKErrorDomain错误0.)"

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
Run Code Online (Sandbox Code Playgroud)

我甚至没有输入我的用户凭据.怎么解决?什么问题?有人知道吗?PS:我在iPad和iPhone设备上测试它 - 而不是模拟器.感谢名单!

在此输入图像描述

iphone app-store in-app-purchase ios4

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

帮助正确计算atan2

我需要计算线之间的角度.我需要计算atan.所以我正在使用这样的代码

static inline CGFloat angleBetweenLinesInRadians2(CGPoint line1Start, CGPoint line1End) 
{
    CGFloat dx = 0, dy = 0;

    dx = line1End.x - line1Start.x;
    dy = line1End.y - line1Start.y;
    NSLog(@"\ndx = %f\ndy = %f", dx, dy);

    CGFloat rads = fabs(atan2(dy, dx));

    return rads;
}
Run Code Online (Sandbox Code Playgroud)

但是我不能超过180度((在179度之后178-160 ...... 150等等).

我需要旋转360度.我该怎么做?怎么了?

maby这有助于:

//Tells the receiver when one or more fingers associated with an event move within a view or window.
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSArray *Touches = [touches allObjects];
    UITouch *first = [Touches objectAtIndex:0]; …
Run Code Online (Sandbox Code Playgroud)

objective-c image-rotation atan2

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

如何从xib创建自定义tableViewCell

我想创建一个自定义的TableViewCell,我想让UITextField具有编辑可能性.所以我用xib创建了新类.添加TableViewCell元素.在它上面拖动UITextField.在我班上添加了插座并将它们连接在一起.在我的TableView方法cellForRowAtIndexPath中,我创建了自定义单元格,但它们不是我的自定义单元格 - 它们只是常用的单元格.我该如何解决这个问题,为什么会这样?感谢名单!

// EditCell.H

#import <UIKit/UIKit.h>


@interface EditCell : UITableViewCell
{
    IBOutlet UITextField *editRow;
}
@property (nonatomic, retain) IBOutlet UITextField *editRow;
@end
Run Code Online (Sandbox Code Playgroud)

//EditCell.m

#import "EditCell.h"


@implementation EditCell
@synthesize editRow;

#pragma mark -
#pragma mark View lifecycle

- (void)viewDidUnload 
{
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
    self.editRow = nil; 
}
@end
Run Code Online (Sandbox Code Playgroud)

//在我的代码中

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString *CellIdentifier = @"EditCell";

    EditCell *cell …
Run Code Online (Sandbox Code Playgroud)

iphone custom-controls uitableview

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

将照片添加到iPhone模拟器

我需要比按钮点击打开iPhone的默认相册,我可以选择一张照片.

我读了很多关于这个,但仍然没有用.我做以下事情:

  1. 〜/库/应用程序支持/ iPhone模拟器/用户/媒体/ DCIM/100APPLE /我存储两张图片IMG_0000.JPG(300像素300)和IMG_0000.THM(75张75px)
  2. 在我的应用程序中,我按下按钮执行以下操作:
- (IBAction) btnOpenAlbum
  {
      album = [[UIImagePickerController alloc] init];
      album.delegate = self;  

      album.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

      [self presentModalViewController: album animated:YES];
  }
Run Code Online (Sandbox Code Playgroud)

我也尝试了UIImagePickerControllerSourceTypePhotoAlbum,但在相册中仍然没有照片.

AI以这样的方式解决了它:

  • 打开iPhone模拟器.
  • 拖动照片.并自动将其复制到文件夹〜/ Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE,并将其命名为IMG_0001.PNG IMG_0002.PNG等.

之后一切正常,但是:当我尝试将项目直接复制到该文件夹​​,并给它们合适的名称时,iphone没有识别它们.而且,当我从该文件夹中删除它们并运行模拟器 - 模拟器上的照片,但在文件夹中它们不是.

它可以是什么?感谢名单.

uiimagepickercontroller ios-simulator

7
推荐指数
1
解决办法
2646
查看次数

将html格式的文本保存到数据库

我想将html格式的文本保存到数据库,但是当我这样做时,它不保存html符号,如</>'和其他这就是我从数据库中读取文章进行编辑的方式:

<p class="Title">??????????? ???????:</p>
    <textarea name="EN" cols="90" rows="20" value="<?php echo htmlentities($articleArr['EN'], ENT_QUOTES, "UTF-8"); ?>" ></textarea>
Run Code Online (Sandbox Code Playgroud)

在此之后生成这样的html代码:

<p class="Title">??????????? ???????:</p>
    <textarea name="EN" cols="90" rows="20" value="&lt;p class=&#039;Title&#039;&gt; ?????? &lt;/p&gt;" ></textarea>
Run Code Online (Sandbox Code Playgroud)

所以,我希望这个文本会出现在我的文本字段中,在这个页面的html代码中,但在文本区域中是没有的.

在数据库中我将​​其保存为:

<p class="Title"> Hello </p>
Run Code Online (Sandbox Code Playgroud)

那么我该怎么做呢:

  1. 从数据库html-formattedtext中读取.
  2. 在textarea元素中显示它.
  3. 编辑并将其保存回数据库.

请帮帮我,我怎么能正确保存这些文本,Thanx!

html php phpmyadmin

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

如何删除android SearchView组件中的底线?

如何删除android SearchView组件中的底线?就像这张图片:

在此处输入图片说明

android searchview android-toolbar

7
推荐指数
3
解决办法
6439
查看次数

未找到类型或不是编译时常量1046

我想从.fla文件中提取SWF文件.我有一些脚本,但是当我把它们拉出来时 - 它们不起作用.我从编译器得到错误:

1046: Type was not found or was not a compile-time constant

**Warning** The linkage identifier 'scrollableContent' was already assigned to the symbol 'pop_ups/__pop_up_other_elements/scrollableContent', and cannot be assigned to the symbol 'pop_ups/__pop_up_other_elements/scrollable_game_content', since linkage identifiers must be unique.
Run Code Online (Sandbox Code Playgroud)

我谷歌那个错误,但没有找到任何适当的答案.我在这里看到了一些信息,但它对我没有帮助.http://curtismorley.com/20 7月6日/ 20 /闪光-CS3柔性-2- AS3-错误-1046 /

请告诉任何人产生此错误的问题是什么,我该如何解决?感谢名单!

flash actionscript-3 flash-cs5

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

如何解决崩溃:Dns.java okhttp3.Dns$1.lookup?

最近我开始收到这样的崩溃。没有更新任何东西来添加吊带。有谁知道什么会导致这个问题?谢谢。

com.squareup.retrofit2:改造:

改造版本 = "2.6.1"; 改造转换器GsonVersion = "2.6.1"; 改造适配器RxJava2版本=“2.6.1”

    Dns.java line 39
okhttp3.Dns$1.lookup

Fatal Exception: io.reactivex.exceptions.UndeliverableException
com.companyname.data.service.retrofit.exception.RetrofitException: Unable to resolve host "api.companyserver.com": No address associated with hostname
io.reactivex.plugins.RxJavaPlugins.onError (RxJavaPlugins.java:349)
io.reactivex.internal.operators.observable.ObservablePublish$PublishObserver.onError (ObservablePublish.java:187)
io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.checkTerminated (ObservableObserveOn.java:276)
io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal (ObservableObserveOn.java:172)
io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run (ObservableObserveOn.java:252)
io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run (HandlerScheduler.java:109)


Caused by com.companyname.data.service.retrofit.exception.RetrofitException
Unable to resolve host "api.companyserver.com": No address associated with hostname
com.lampa.letyshops.data.service.retrofit.adapter.RxErrorHandlingCallAdapterFactory$Rx2CallAdapterWrapper.asRetrofitException (RxErrorHandlingCallAdapterFactory.java:75)
com.lampa.letyshops.data.service.retrofit.adapter.RxErrorHandlingCallAdapterFactory$Rx2CallAdapterWrapper.access$000 (RxErrorHandlingCallAdapterFactory.java:41)
com.lampa.letyshops.data.service.retrofit.adapter.RxErrorHandlingCallAdapterFactory$Rx2CallAdapterWrapper$1.apply (RxErrorHandlingCallAdapterFactory.java:62)
com.lampa.letyshops.data.service.retrofit.adapter.RxErrorHandlingCallAdapterFactory$Rx2CallAdapterWrapper$1.apply (RxErrorHandlingCallAdapterFactory.java:59)
io.reactivex.internal.operators.observable.ObservableOnErrorNext$OnErrorNextObserver.onError (ObservableOnErrorNext.java:91)
retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onError (BodyObservable.java:72)
retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:55)
io.reactivex.Observable.subscribe (Observable.java:10955)
retrofit2.adapter.rxjava2.BodyObservable.subscribeActual (BodyObservable.java:34)
io.reactivex.Observable.subscribe (Observable.java:10955)
io.reactivex.internal.operators.observable.ObservableOnErrorNext.subscribeActual (ObservableOnErrorNext.java:38)
io.reactivex.Observable.subscribe (Observable.java:10955)
io.reactivex.internal.operators.observable.ObservableMap.subscribeActual (ObservableMap.java:33)
io.reactivex.Observable.subscribe (Observable.java:10955) …
Run Code Online (Sandbox Code Playgroud)

android crash-reports crashlytics-android retrofit2

6
推荐指数
1
解决办法
4800
查看次数

MaterialDatePicker 选择后返回不正确的日期

由于某些未知原因,MaterialDatePicker 在选择后返回不正确的日期。例如,用户位于墨西哥地区,时区为:America/Tijuana。当他在视觉表示中选择:2021-10-05时,在结果文本中我有-1天,2021-10-04。对于 RU 地区,一切正常。这是代码:

public void startDateSelectionPicker() {
    try {
        MaterialDatePicker<Long> picker = MaterialDatePicker.Builder.datePicker()
                .setSelection(MaterialDatePicker.todayInUtcMilliseconds())
                .setTheme(R.style.CustomDatePickerDialog)
                .build();

        picker.addOnPositiveButtonClickListener(selection -> {
            TimeZone t = TimeZone.getDefault();
            Calendar c1 = Calendar.getInstance();
            c1.setTimeInMillis(selection);
            c1.setTimeZone(TimeZone.getDefault());

//here I need to receive correct date, but receiving -1 from originally selected date.

            String date = ToolsManager.calendarToDate(this, c1, "yyyy-MM-dd");
        });
        picker.show(getSupportFragmentManager(), picker.getTag());
    } catch (IllegalArgumentException e) {
    }
}

public static String calendarToDate(Context context, Calendar calendar, String dateFormat) {
        if (calendar == null) {
            return null;
        }

        Locale locale …
Run Code Online (Sandbox Code Playgroud)

timezone android android-calendar java-time materialdatepicker

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